Mail Archives: djgpp/1994/04/19/10:29:07
I am unable to use argv[1][0] when it is '?' and the program runs
from any directory differnet from the root.
Example: PROGRAM.C
#include <stdio.h>
main(int argc, char *argv[])
{
printf ("Nr of arguments: %d. argv[1]: %s, argv[2]: %s",
argc, argv[1], argv[2]);
}
I compile this code with GCC and I put the EXE file on a directory
accesible from my path. If I runs from the root:
C:\>PROGRAM ? hello
the result is ok:
Nr of arguments: 3. argv[1]: ?, argv[2]: hello
But if I run it from another directory:
C:\DOS>PROGRAM ? hello
the result is WRONG
Nr of arguments: 2. argv[1]: hello, argv[2]: (null)
HOW CAN I SOLVE THIS PROBLEM?????
* This problem also occurs if I run PROGRAM from a floppy disk (A:, B:) or
from another hard disk (D:).
* We are working on a 486, MS-DOS (ver. 6.2) machine.
* We compile using a .BAT file like this:
gcc -Ic:/include -O c:/tc/c/c32/%1.c -lm -lpc -o c:/tc/proves/c32/%1.out
coff2exe -s d:\djgpp\bin\go32.exe c:\tc\proves\c32\%1.out
My name is Xavier Pons; my e-mail is:
ibbt0 AT cc DOT uab DOT es /* Note that it is "ibbt0", not "ibbto" */
Many thanks for your help!!!!
- Raw text -