Author Topic: How do I pass a file as a command line argument in Debug?  (Read 7729 times)

Offline mfcummings

  • Single posting newcomer
  • *
  • Posts: 4
How do I pass a file as a command line argument in Debug?
« on: February 18, 2010, 05:56:46 pm »
Hello,

I want to debug a program that I'm having problems with.  Rather than restructure the whole program to bypass the initial specifications, I was hoping to discover a way to pass a file as an argument in debug mode.  I have a simple console project that parses a text file, I tried Project-> "Set Programs Arguments..." and included the name of the text file with all of the possible variations (highlighting "Debug" & "Release", check/uncheck "This target provides..", putting the file name in quotes, etc.) to no avail.

I'm using Code::Blocks v. 8.02 on Win7 using a simple notepad .txt file as an input parameter.

Please advise, Thanks for your input.

MFC

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: How do I pass a file as a command line argument in Debug?
« Reply #1 on: February 18, 2010, 06:10:14 pm »
Please advise, Thanks for your input.
Did you ensure that you setup the path to execute the application correctly in the project settings for your debug target?
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline mfcummings

  • Single posting newcomer
  • *
  • Posts: 4
Re: How do I pass a file as a command line argument in Debug?
« Reply #2 on: February 18, 2010, 08:09:32 pm »
I did not, but with your suggestion I added the complete path.  When that didn't work, I wrapped the full path in quotations and that did work!

Thank you for your suggestion, you solved my problem and now I can concentrate on more productive troubleshooting.   :D