Mail Archives: djgpp/1998/03/23/06:05:41
At 04:57 3/22/1998 +0100, ^Hawk^ (Thorsten Kaben) wrote:
>On Sat, 21 Mar 1998 17:35:44 -0800 (PST), you wrote:
>
>>First of all, why do you use `__crt0_argv'? You're supposed to use the
>>arguments `main' gets.
>Sorry ... I don't understand all here ... my english ... :( ... if I
>try to use only "_argv[x]" or "argv[x]" then the compiler tould me
>that this is undeclared in spite of including the crt0.h ... if I use
>"__crt0_argv[x]" then it works fine ...
The way command lines are passed in C, you declare the `main' function as
taking arguments. These are traditionally called `argc' for the number of
args, and `argv' as the array. So it really should look like:
int main (int argc, char *argv[])
{
/* Do things with argv[x] */
}
The `__crt0' ones are for the library's internal use, and probably won't
work on other compilers or even future versions of DJGPP.
>
>>If you really *must* have `\'s (like if your program scans filenames for
>>them), you can #include <crt0.h> and put this line at the top level (i.e.,
>>not inside any function):
>>_crt0_startup_flags = _CRT0_FLAG_USE_DOS_SLASHES;
>>See the libc documentation for "_crt0_startup_flags" for more info.
>Great! Thank you! ;)
>
>PD: I'm a C++ and DJGPP beginner ... I come from BP v7.0 and want now
>to write programs without memory problems and for more as only one
>environment ... before C++ I had to use an overlay file to solve my
>problems with the 640KB ... :( ... but now I hope that's history for
>me and my programs ... =:) ...
Actually, even most DOS C++ compilers have that kind of restriction. Isn't
DJGPP great?
P.S. There is also a Pascal compiler for DJGPP, though it doesn't have most
of the features of Borland's.
Nate Eldredge
eldredge AT ap DOT net
- Raw text -