I'm trying to print some strings using printf()
but they are null terminated having trailing newline and that messes with the formating:
printf("The string \"%s\" was written onto the file \"%s\"", str, fname);
Say the string contains "The Racing car."
and the file name is "RandomText1.txt"
This prints:
The string "The Racing car.
" was written onto the file "RandomText1.txt
"
However I want it to print in just one line:
The string "The Racing car." was written onto the file "RandomText1.txt"
I know I can modify the strings to get rid of the null terminator newline but I'd like a way, if possible, to achieve this output without modifying the strings.
Is it possible?