www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/09/05/22:51:16

Xref: news-dnh.mv.net comp.os.msdos.djgpp:1920
Newsgroups: comp.os.msdos.djgpp
Path: news-dnh.mv.net!mv!news.sprintlink.net!howland.reston.ans.net!math.ohio-state.edu!cis.ohio-state.edu!nntp.sei.cmu.edu!fs7.ece.cmu.edu!cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!oitnews.harvard.edu!cfanews!cfa0!peprbv
From: peprbv AT cfa0 DOT harvard DOT edu (Bob Babcock)
Subject: Surprised by getcwd in v2
Sender: news AT cfanews DOT harvard DOT edu
Reply-To: rbabcock AT cfa DOT harvard DOT edu
Organization: Smithsonian Astrophysical Observatory, Cambridge, MA, USA
Date: Tue, 5 Sep 1995 02:53:05 GMT
Lines: 7
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Dj-Gateway: from newsgroup comp.os.msdos.djgpp

The behavior of v2 getcwd is a little surprising to a DOS programmer:
getcwd returns NULL if passed a NULL buffer.  Comments in the code say
that POSIX behavior is undefined in this case.  Borland and djgpp 1.x
allocate memory for you if buffer is NULL.  libc.inf documents the new
behavior, but then muddies the waters by saying that the return value
is "either BUFFER or a newly-allocated buffer".  It doesn't appear
that getcwd ever allocates memory.

- Raw text -


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