Date: Wed, 12 Apr 1995 21:15:56 -0500 (CDT) From: Aaron Ucko Subject: Re: port borland to djgpp To: bob AT xnet DOT com Cc: djgpp AT sun DOT soe DOT clarkson DOT edu Organization: Rockhurst College; Kansas City, MO >> ltoa, ultoa >> >> - ltoa converts a long to a string >> - ultoa converts an unsigned long to a string > >i had this problem myself. i think it might be because gcc considers ints to >be longs instead of shorts as does borland. i think i saw an itoa(). this >might do, otherwise, i'm using sprintf( %s, "%ld", (long) ); i had already >made this change b4 i realized i had to change all of my int's to short int's. > >i didn't notice, but i wonder if there's a stoa for short 2 ascii? Just an itoa. If you're interested in portability, however, you should probably just use sprintf(); the Linux standard library, for instance, only has routines to convert from strings to integers. >> >> getcurdir >> >> Gets current directory for specified drive. >> >> Declaration: int getcurdir(int drive, char *directory); > >i think there's a getcwd() or something similar? im not sure how gcc handles >DOS drive specs, but i know it uses standard unix notation for the paths, so >'/' instead of '\'. this is also more portable. i think Borland has this as >well. Of course, you will have to save the current directory and change to the appropriate drive if you want to find the current directory on another drive (which is reasonable enough; I know of no OS besides DOS [and derivatives such as Windoze and OS/2] which has such a concept). > >> getftime, setftime >> >> Gets or sets file date and time >> >> Declaration: >> - int getftime(int handle, struct ftime *ftimep); >> - int setftime(int handle, struct ftime *ftimep); > >dunno about this one. Use stat() for the former and utime() for the latter [both with appropriate wrappers, of course]. Note that both take names rather than handles (which also makes sense; it's hard to set the time of stdout). >> >> >> filelength >> >> Gets file size in bytes >> >> Declaration: long filelength(int handle); > >im not sure about this one, but if all else fails, i'd do an lseek to the end >of the file and then use the tell() command to find the length. this should >work, tho i've not tried it w/ djgpp/gcc It'll work, as will another appropriately wrapped call to stat(). --- Aaron Ucko (ucko AT vax1 DOT rockhurst DOT edu; finger for PGP public key) | httyp! Geek code 2.1 [for explanation, finger hayden@ | `God's Laws' (Rudy Rucker, vax1.mankato.msus.edu]: GCS/M/S d(-) H s g+ p? \ _Master of Space and Time_): !au a17 w+ v+(++) C++(+++)>++++ UL++(S+)>++++ \ 1) Be clean. 2) Follow Gary. P+(++) L++ 3(-) E- N+(++) K- W--(---) M-@ V-(--) \ 3) Teach God's Laws. po-(--) Y+ t(+) !5 j(++) R(-) G' tv--(-) b+++ +--------------------------- !D(--) B--(---) e>++++(*) u++(@) h!() f(+) r-(--)>+++ n+(-) y?