Click here to Skip to main content
15,904,156 members

Comments by k5054 (Top 200 by date)

k5054 23hrs ago View    
1: I think maybe you replied at the wrong place, and this should be a reply to one of the solutions, below
2: If this is a static string, why go through the work of extracting things later? Why not just create your extracted objects at the get go? Seems like unnecessary work to me, with the added possibility of having to debug later. Creating the aggregate string from those objects shouldn't pose too much difficulty.
k5054 23hrs ago View    
My 5.
I always forget about raw string literals. :(
k5054 23hrs ago View    
White space is acceptable when concatenating a string constant, so you can remove the trailing \, and to OP probably wants a trailing newline (\n) as well. Perhaps even some initial spaces too.

To the OP: multi line string constants are not valid in C/C++.
k5054 16-May-24 11:52am View    
Pete's function has a bug. file.eof() only returns true after a read is attempted beyond the end of the file. Instead of if ( file.eof() ) { try if ( file.peek() == EOF) {
k5054 16-May-24 11:33am View    
I think you meant a function definition, rather than a call, just to clarify for the OP