Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » how to use the Arguments in the run configuration(C program, running a text file in the command line)
how to use the Arguments in the run configuration [message #784068] Fri, 27 January 2012 02:45 Go to next message
okechukwu anyanwu is currently offline okechukwu anyanwuFriend
Messages: 2
Registered: January 2012
Junior Member
void getInputFile(char** argv[]) {

//Local Declaration
FILE* spIn;

printf("\nRetrieving Data");
spIn = fopen("argv[1]", "r");

if(!spIn){
printf("\nCould not open input file\a\n");
}

This is a function that I have written in eclipse (Indigo). In my project folder I have 3 sub-folders the source folder, release folder and debug folder. I have also created a text file and placed a copy of this text file in each sub-folder. This are the steps I took read the text file. Run Configuration -> my project release folder is selected -> Arguments under the Program arguments I typed in the name of the text file inputFile.txt. And I clicked on the run button. but the error message I programmed came up. It seems as though eclipse cannot find my inputFile.txt. How do I correct this problem. Thank you!
Re: how to use the Arguments in the run configuration [message #784132 is a reply to message #784068] Fri, 27 January 2012 05:01 Go to previous message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4093
Registered: July 2009
Senior Member

Arrays in C start with indexes of 0. Try printing out argv[0] as part of the error message.

Nitin Dahyabhai
Eclipse Web Tools Platform
Previous Topic:Assigning a keystroke to a macro (practicalmacro)
Next Topic:Compatibility of InstanceScope in lower version of eclipse
Goto Forum:
  


Current Time: Thu Aug 05 22:30:04 GMT 2021

Powered by FUDForum. Page generated in 0.08252 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top