fsckin windows

Random irrelevance that just didn't fit into other forums. Talk about anything.

Moderator: Talkative People

Post Reply
User avatar
M_D_K
Chaos Rift Demigod
Chaos Rift Demigod
Posts: 1087
Joined: Tue Oct 28, 2008 10:33 am
Favorite Gaming Platforms: PC
Programming Language of Choice: C/++
Location: UK

fsckin windows

Post by M_D_K »

so here's a little tale of why you should always open files as binary.

so I'm parsing text files for a little something I'm doing to fill time, and I start noticing the parsing catching in an infinite loop on windows, part of the parsing is looking ahead in the file for newlines(\n) so I'm not ending up with half a line in the buffer and having to deal with it.

the problem is how windows handles \n, when you open a file as just "r" (like fopen(file, "r");) windows expands \n to CR''LF on writes and compresses it to \n on reads (that's what bottom poster here says)

damn annoying!

I didn't have this problem on nix (linux, mac) because there's no expanion.
Gyro Sheen wrote:you pour their inventory onto my life
IRC wrote: <sparda> The routine had a stack overflow, sorry.
<sparda> Apparently the stack was full of shit.
Post Reply