Mail Archives: djgpp/1996/05/13/18:51:03
Dieter Demerre (Dieter DOT Demerre AT cs DOT kuleuven DOT ac DOT be) wrote:
: 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").
: If I do not include anything special, apparently the correct
: mkdir is included from a library since the action is performed
: correctly.
: Anyhow, where should int mkdir() be defined ?
Well, that depends on what you want to be compatible with.
mkdir is a POSIX.1 function with the prototype (char *,int), where the 2nd
parameter is the unix permission to give to the directory. On DOS, this is
not available, so the BC/MSC definition doesn't have the parameter at all.
The reason why this works without a prototype is that the 2nd parameter is
ignored by the DJGPP mkdir implementation. Nevertheless, you should try to get
the prototype (e.g. if you are compiling C++, you have to). To be compatible
between BC and DJGPP or unix, you can best use a macro to define the mkdir
call correctly, something like
#ifdef __BORLANDC__
#define mkdir(n,x) mkdir(x)
#endif
should do it (untested, maybe you have to give it another name).
bye, Alexander
--
Alexander Lehmann, | "On the Internet,
alex AT hal DOT rhein-main DOT de (plain, MIME, NeXT) | nobody knows
alexlehm AT rbg DOT informatik DOT th-darmstadt DOT de (plain) | you're a dog."
<URL:http://www.student.informatik.th-darmstadt.de/~alexlehm/>
- Raw text -