www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/02/04/14:10:26

From: brian AT godzilla DOT MicroUnity DOT com (Brian Smith)
Subject: fwrite and dos files
To: djgpp AT sun DOT soe DOT clarkson DOT edu (djgpp mailing list)
Date: Fri, 3 Feb 95 7:22:56 PST


   I have installed djgpp with gcc version 2.6.0. I am trying to use
fwrite to write a static character array to a dos file. When I look 
at the output file with debug, I find that all of my 0xa (LF) have
been replaced by 0x0d 0x0a (CR/LF).

   I am used to a unix environment where fwrite writes just the bytes
I tell it to 8-) Am I missing something silly? Can someone explain 
this to me?

   My test case looks is:


#include <stdio.h>

FILE *ofile;

static char buff[] = {0x20,0x20,0x20,0xa,0x20,0xa,0xa};

main() {

   ofile = fopen("splat.out","w");
   fwrite(buff, sizeof(buff), 1, ofile);
}

		- Brian -

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019