When I'm trying to write on a file the following program gives an error with gcc 4.5.1 on fedora and gcc 4.1.2 on centos 5.5.
I think it is correct because I got it from a book.
int main ( int argc, char **argv )
fp = fopen ( "fichero.txt", "r+" );
printf("\ntype the text on file: ");
while((caracter = getchar()) != '\n')
printf("%c", fputc(caracter, fp));
fclose ( fp );
->gcc xxxx.c -o xxxx
"Segment Violation" ('core' generated)
Thank you very much!