Code::Blocks Programs' argument
I tried everything to debug my project with an input file. but it doest work.
"C:\\....tabu\\bin\\debug\\tabu.exe"<input.txt
isnt that true? or what is the true one? somebody please tell me....
I don't think you can pass in arguments like that. If you need to pass in a filename just use:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
#include <fstream>
int main(int argc, char **argv)
{
if(argc > 1) // maybe passed in filename
{
ifstream in(argv[1]);
if(in.good()) // was the argument a valid filename?
{
// filename was valid, process accordingly...
} else {
// filename wasn't valid... deal with it
}
}
return 0;
}
|
Last edited on
it works. but it doenst take my input file as input datas. I just want it to run like this when i debug it:
c:\myproject>myProject<input.txt |
how can I do it?
Topic archived. No new replies allowed.