executable with parameters
Hi
I've made a program which takes in 2 filenames and then converts it into a 3rd file. What I want is to have this process as a executable parameter.
Example:
convert.exe <parameters> filename1 filename2 target_filename
Could someone guide me to write this....
Thanks in advance...
What do you mean by 'convert'? Do you mean appending the second file to the first file?
The main function recieves an array of strings with command line arguments, you'll have to parse them manually. Also beware that the first argument is the executable's name and not an actual parameter.
int main(int argc, char **argv) { if(argc < 4) { printf("syntax: %s {filename1} {filename2} {target_filename}\n", argv[0]); return 1; } const char *fn1 = argv[1]; const char *fn2 = argv[2]; const char *target = argv[3]; // etc..}
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement