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 21:20

>>26
Not necessarily.

Name: Anonymous 2007-11-09 3:04

>>28
Yeah, I should learn my shit I guess. So sizeof(char) is guarenteed to be 1. Mark me if I'm wrong on this (just to get shit straight): for all other primitives (int, float, long int, etc) the only guarentee is that -

1 = sizeof(char) < sizeof(short) < sizeof(int) < sizeof(long int) etc

And that sizeof(size_t) is the size of a word on the system, and also equal to sizeof(void*).

Anything else wrong in my general beliefs about esoteric C stuff? I seem to have gotten dickslapped pretty hard and don't really want to spread my disinformation any more.

Name: Anonymous 2007-11-09 5:53

>>31
Tell me what compiler/platform has the property where they're all the same size. Can you name but one platform?

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