Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Problem with C fwrite

Name: Anonymous 2007-11-08 12:51

What the fuck? Why, when I try to write a string to a text file using C, does it change the first character to "ÿ"?

e.g.

ÿ10
ÿhis
ÿololol
ÿhis

(all input on different runs of the program).

I'm using "a+" if that makes any difference, though I've tried with "r+" aswell and that does the same thing.

Any help?

Name: Anonymous 2007-11-08 13:46

>>6

void write()
{
 char name[20];

 printf("\nname: ");
 gets(name);
 FILE *input=fopen("file.txt", "a");
 *username=getc(input);
 fseek(input, 0, SEEK_END);
 if(input!=NULL)
 {
  fprintf(input, "%s\n", name;
 }
}

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List