I've been porting a Linux/Mac command-line application to Windows XP using Dev-C++. It's all working other than one particular part where command line arguments are copied to strings. The command line options are processed by argtable in the same way as the first piece of example code. Here's the struct that concerns a "key file" which the users must supply.
Code:
struct arg_file *key = arg_file0("k",NULL,"<key>", "key file (<username>_pass.pem)");
The code pops up a box asking if I'd like to report it's crash to Microsoft when it reaches this part:
Code:
strcpy(keyfile,key->filename[0]);
N.B. I have already defined a "char keyfile[32]" and the keyfile's name is shorter than that. Strangely, the following line prints out the key file name exactly as expected:
Code:
printf("%s\n",key->filename[0]);
Also if I replace the key->filename[0] with a quoted file name in the strcpy above then the rest of the code runs as it should. Can anyone suggest what the problem might be?