www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/08/14/04:12:29

From: "A.Appleyard" <A DOT APPLEYARD AT fs2 DOT mt DOT umist DOT ac DOT uk>
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Date: Mon, 14 Aug 1995 09:06:34 BST
Subject: Re: Reading a file with read()

  pdrap AT ctp DOT com (Patrick Draper) wrote:-

> I've got a program that does a read() call to read a block from a file. ...
> What do I need to do to open the file in a true binary mode, with no CR/LF
> translation going on?

  F=fopen(myfilename,"rb");         or          j=open(myfilename,0x8001);

open(s,i)     /* open file named s, in mode i (additive):-
              0x0001 = read only      0x0002 = write only     0x0004 = both
              0x0100 = create, write  0x0200 = old, empty it  0x0400 = not old
              0x0800 = append         0x4000 = text           0x8000 = binary
   (#defined thus in <FCNTL.H>:-
   O_RDONLY O_WRONLY O_RDWR O_CREAT O_TRUNC O_EXCL O_APPEND O_TEXT O_BINARY)
                Returns {int} = file number (-1 if error) */

- Raw text -


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