www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/11/22/18:13:13

From: gorman AT gpu DOT srv DOT ualberta DOT ca (Gorman Ho)
Newsgroups: comp.os.msdos.djgpp
Subject: read() question!!!!!!!!!
Date: Fri, 22 Nov 1996 17:13:32 GMT
Organization: Nowhere
Lines: 27
Message-ID: <574j6m$ptc@pulp.ucs.ualberta.ca>
Reply-To: gorman AT gpu DOT srv DOT ualberta DOT ca
NNTP-Posting-Host: async14-10.remote.ualberta.ca
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I have a slight problem with libc.a's read() function. When I execute
the following code:

---
#include <all header files required>

main()
{
  int File = open(Filename, O_RDONLY);
  char Buffer[20] = read(File, Buffer, 19);
  puts(Buffer);
  close(File);
  return 0;
}
--  // compiled with 'gcc file.cpp'

It does everything right, but the output is like this:
--
DJGPP is the bestt
--
For some reason there is an extra 't' in the example. When I read a
lot of characters (say 80 or so), there are 3 extra characters!! What
am I doing wrong here??

Thx   Gorman


- Raw text -


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