I want to fprintf() 3 strings to a file, all on the same line.
The first two cannot contain spaces while the 3rd may. I.E. word word rest of line
Can some one tell me how to fscanf() that into 3 variables?
I don’t mind putting some delimiters if it makes it easier. E.G. [word] [word] [rest of line]
You can do it without delimiters, too:
This should work, as long as the input
lineactually does end with a newline.Of course, you should adjust the string sizes to fit. Also you can get trickery with the preprocessor to avoid repeating the sizes, but doing so makes it more complicated so I avoided that for this example.