Xref: news2.mv.net comp.os.msdos.djgpp:3805 From: alexlehm AT rbg DOT informatik DOT th-darmstadt DOT de (Alexander Lehmann) Newsgroups: comp.os.msdos.djgpp Subject: Re: where to find the header for int mkdir()? Date: 13 May 1996 16:06:07 GMT Organization: Technische Hochschule Darmstadt Lines: 40 Message-ID: <4n7mlf$1o6j@rs18.hrz.th-darmstadt.de> References: <3197493B DOT 2781E494 AT cs DOT kuleuven DOT ac DOT be> NNTP-Posting-Host: hp62.rbg.informatik.th-darmstadt.de To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp 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."