Hello, I want your help in C. I have a file which contains lines with spaces. When I use printf("%s",str) it prints my data in new lines but I want to display them in a single line. Is there any way to do it? Thanks!
I found how to print the whole string! I used fgets and printf worked fine!
Can you help me now how to insert a string with spaces? Like: My Book 1.
I used gets but it does not work...Is there any other command to read string with spaces?
Book b ;
Book* book = &b ;
// read a full line upto a maximum of 100 characters in length
// the line may contain spaces
char* p = fgets( book->title, 100, stdin ) ;
// remove the new line at the end
if(p) book->title[ strlen(p) - 1 ] = 0 ;