hello guys
i need some help to this code:
everything works fine. but when the program asks for the text that shall be written to the file and i type something like:Code:#include<stdio.h> void main (void) { char input; FILE *file; file = fopen ("self.dat", "w+"); if (file==NULL) { printf("an error occured!\n"); } else { printf("what shall be written into the file: \n"); scanf("%c", &input); fprintf(file, "%c", input); printf("\nclosing file!\n"); fclose(file); } }
"hello world i love you" and take a look at the file, there only exists the first word. in this case "hello".
how do i configure the source code that its possible to safe a whole sentence.(or even more than this!).
thanks for the help
threadhead