Changed from only strings to vector-strings
This commit is contained in:
		
							parent
							
								
									5ac832623d
								
							
						
					
					
						commit
						36f252437d
					
				| @ -6,17 +6,17 @@ | |||||||
| 
 | 
 | ||||||
| using namespace std::string_literals; | using namespace std::string_literals; | ||||||
| 
 | 
 | ||||||
| std::string buffer = ""; | std::vector<std::string> buffer; | ||||||
| void bufHandler(char *buf){ | void bufHandler(char *buf){ | ||||||
|     // When first char of buf has text (no space), we got a new packet
 |     // When first char of buf has text (no tab), we got a new packet
 | ||||||
|     if(buf[0] != ' '){ |     if(buf[0] != '\t'){ | ||||||
|         // Submit the just-read text-packet
 |         // Submit the just-read text-packet
 | ||||||
|         textPacketHandler(buffer); |         if(buffer.size() != 0) textPacketHandler(buffer); | ||||||
|         buffer = buf; |         buffer = std::vector<std::string>(); | ||||||
|     }else{ |  | ||||||
|         // Append part-packet
 |  | ||||||
|         buffer += "\n"s + buf; |  | ||||||
|     } |     } | ||||||
|  | 
 | ||||||
|  |     // Append part-packet
 | ||||||
|  |     buffer.push_back(buf); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| #endif /* C251BA62_6D80_4033_86B6_61F184E6F250 */ | #endif /* C251BA62_6D80_4033_86B6_61F184E6F250 */ | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user