int _tmain(int argc, _TCHAR* argv[])
{
if (argc != 3) {
printf("Format is straightline.exe <EO records file> <output file>");
return 1;
}
string eoPath = string(__argv[1]);
//...other stuff ...
}
If __argc == 3, how can __argv be a null pointer?
My debugger is telling me that __argv is pointing to 0x00000000 after the program crashed when I was trying to reference __argv[1] (and I have verified that __argc == 3). This is a minimal program and it happened in the beginning before I did any sort of processing.
If this is complied as unicode, then will be null, while __argv will contain what you want. I believe that there is a __wargv that should contain the command line arguments regardless of unicode or ascii.__targv
But why use any of these if you can just use argv passed in as a parameter to _tmain?
The pointer to __argv can (and will) be null in Unicode configurations.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With