www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1993/07/26/15:00:22

Posted-From: The MITRE Corporation, Bedford, MA
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: creat doesn't use proper default filetype
Date: Mon, 26 Jul 1993 14:39:10 -0400
From: "Daryl K. Baker" <dkb AT nmc42 DOT mitre DOT org>

When porting a copy of apps that use creat I noticed that the files
opened were in "binary" mode instead of the default text mode.

This occurs using version 1.10 of go32 1.10, and gcc 2.4.1

--demo program --
#include <fcntl.h>
#include <string.h>

char *string = "this is a test\n second line\n";

main ()
{
   int fd1;
   int fd2;

   fd1 = open ("t1", O_CREAT | O_WRONLY);
   fd2 = creat ("t2", 0666);
   write ( fd1, string, strlen(string));
   write ( fd2, string, strlen(string));
}

-- output --
t1:
this is a test
 second line

t2:
this is a test
               second line


--- T1 and T2 should be the same.


- Raw text -


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