Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!hp4nl!ruuinf!praxis!jeroen From: jeroen@cs.ruu.nl (Jeroen Fokker) Newsgroups: comp.sys.atari.st.tech Subject: Re: REPOST: binary write question Message-ID: <4821@ruuinf.cs.ruu.nl> Date: 12 Feb 91 08:44:37 GMT References: Sender: news@ruuinf.cs.ruu.nl Lines: 30 In ericco@ssl.berkeley.edu (Eric C. Olson) writes: > My question is basic: how do I write character code 10 > using write, as in: > > { > char c = 10; > int fd = open("test.dat", O_BINARY|O_WRONLY) > write(fd, &c, sizeof(c)); > close (fd) > } > >When I do this, i get carriage return AND linefeed in the file >"test.dat". I'm using Laser C. You can use file-I/O on another level: Atari GEMDOS calls. It would look like this: int f; if (newfile) f = Fcreate( "test.dat", 0 ); else f = Fopen( "test.dat", 2 /* for read/write */ ); Fwrite( f, (long)(sizeof(c)), &c ); Fclose(f); -- Jeroen Fokker | jeroen@cs.ruu.nl dept.of Computer Science, Utrecht University | tel.+31-30-534129 PObox 80089, 3508TB Utrecht, the Netherlands | fax.+31-30-513791