Skip to main content



      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] Thu, 26 January 2012 21:45 Go to next message
Eclipse UserFriend
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 00:01 Go to previous message
Eclipse UserFriend
Arrays in C start with indexes of 0. Try printing out argv[0] as part of the error message.
Previous Topic:Assigning a keystroke to a macro (practicalmacro)
Next Topic:Compatibility of InstanceScope in lower version of eclipse
Goto Forum:
  


Current Time: Sun Jul 06 13:32:43 EDT 2025

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

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

Back to the top