www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/05/13/21:00:05

From: j DOT aldrich6 AT genie DOT com
Message-Id: <199605140034.AA002094052@relay1.geis.com>
Date: Tue, 14 May 96 00:06:00 UTC 0000
To: djgpp AT delorie DOT com
Mime-Version: 1.0
Subject: Re: where to find the header f

Reply to message 0433583    from DIETER.DEMERR on 05/13/96 10:37AM


>While porting my program from BC3.1 to DJGPP v2, I got the
>warning of an implicit declaration of int mkdir(...).
>When I grep-ed the include-directory, I found that in
>sys/stat.h there's a prototype for mkdir(char*,int,int);.
>while in BC3.1 there's int mkdir(char*) in dir.h
>
>If I include sys/stat.h, I get the message that there are too
>few arguments to mkdir("testfile").

That's because DJGPP defines mkdir differently than BC.  Just look in
the info docs to find the correct usage and modify your program
accordingly.  Remember that DJGPP is a Unix-derived compiler and
thus has different definitions of a number of functions.

>If I do not include anything special, apparently the correct
>mkdir is included from a library since the action is performed
>correctly.

This is very dangerous!  Your program is linking in the DJGPP
version of mkdir, which expects ( char*, int, int ), and passing it
( char * ).  Fortunately, this doesn't appear to result in any serious
problems in your program, but it is a surefire guarantee of
crashes if done too often.

>Anyhow, where should int mkdir() be defined ?

AFAIK, there is no place where it _should_ be defined according
to ANSI C.  Different compilers may define it in different places.
In DJGPP it is defined in sys/stat.h.  Include that header and
modify your usage of mkdir appropriately, or you could be treading
on very thin ice.

- Raw text -


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