Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: Kuriyaki on March 18, 2008, 06:10:59 am

Title: Command Line Arguments
Post by: Kuriyaki on March 18, 2008, 06:10:59 am
Is it possible to use command line arguments? In other words...

int main( int argc, char* argv[] )
{
    ... // Program that uses the input from user in terminal window? argv[1], 2...etc
   
    return 0;
}

I'm fairly new with CodeBlocks. Sorry for the question. Looks great so far!
Title: Re: Command Line Arguments
Post by: Ceniza on March 18, 2008, 10:10:41 am
Yeah, sure. Just add them thru Project -> Set program's arguments... Select the target you want, add its arguments and click OK. Now, when you click on Run, Code::Blocks will pass those arguments to your executable.

Before you ask: it only works for projects.
Title: Re: Command Line Arguments
Post by: Kuriyaki on March 18, 2008, 05:54:50 pm
Awesome! Thank you very much. Was afraid people would consider it a coding/development question.
Title: Re: Command Line Arguments
Post by: Kuriyaki on March 18, 2008, 06:08:31 pm
Whenever I want to read/write to a file in CodeBlocks

Where should I place those files? Under the main project folder? Is it able to write to files? Been trying to and it doesn't allow me.