Eddie N

I have old programs combining Turbo C and dBase. I have just moved them to Visual C++ and FoxPro. I am a beginner in C++. One of the line in the dBase says "Run ThisTurboCprogram XXX" where XXX is the parameter. After changes in a few lines, the program works OK. But I am at a loss as to how to pass the xxx parameter to the Visual C++ program if I compile one. I believe that kind of parameter passing is obsolete in Visual C++, but how should I start

Re: Visual C++ General Working around Old parameter in C app

Jonathan Caves - MSFT

No: you can pass command-line arguments to almost any C++ program.

Just make sure that your 'main' function has a signature something like:

int main(int argc, const char* argv[])
{
}

argc is the number of command-line arguments - argv is an array of the arguments.






Re: Visual C++ General Working around Old parameter in C app

Nugroho2

Thanks so much, but suppose I want to compile it into a win32 app, where should I place the argument

  • // zzz.cpp : Defines the entry point for the application.
  • //
  • #include "stdafx.h"
  • int APIENTRY WinMain(HINSTANCE hInstance,
  • HINSTANCE hPrevInstance,
  • LPSTR lpCmdLine,
  • int nCmdShow)
  • {
  • // TODO: Place code here.
  • return 0;
  • }







Re: Visual C++ General Working around Old parameter in C app

TilakGopi

1)Go to Project Properties

2)Select

      | Configuration Properties in the left side tree(below to Configuration Combo box).

          |- --Debugging node(it's child node)

3)Now on right side in the same properties dialog , u'll be able to see a list box below the Debugger to Launch combo box.

4)In that list box ,

          a)select first column of second  row, Commad line arguements.

          b)Enter ur arguements in the second column.- These will come as  LPSTR     lpCmdLine in WinMain.

 

Hope i made u that u could do it .Didn't i

 

Thanx,

Ch.T.Gopi Kumar.






Re: Visual C++ General Working around Old parameter in C app

Nugroho2

I am sorry, but I could not find the Project properties, or Configuration properties you refer to. I am using Visual C++ 6.0



Re: Visual C++ General Working around Old parameter in C app

Jonathan Caves - MSFT

Visual C++ 6.0 is no longer supported.




Re: Visual C++ General Working around Old parameter in C app

TilakGopi

Oh,

I'm using VS2005.I'll let u know how to give CLA in VC6.0 by tomorrow.

Thanx,

Ch.T.Gopi Kumar.






Re: Visual C++ General Working around Old parameter in C app

TilakGopi

Hi,

U have to give the CLA at

Project Settings->Debug Tab->Program Argumements in VC6.0

Thanx,

Ch.T.Gopi Kumar.






Re: Visual C++ General Working around Old parameter in C app

Nugroho2

Thanks so much for your help. But I still could not understand. Where should I put the equivalent of

Code Snippet

int main(int argc, const char* argv[])


in the program ...




Re: Visual C++ General Working around Old parameter in C app

TilakGopi

Hi,

what ever u give in Project Settings->Debug Tab->Program Argumements,

that will come argv[] array.

And sorry,

Where should I put the equivalent of

Code Snippet

int main(int argc, const char* argv[])

I didn't get u what u meant by this.

Thanx,

Ch.T.Gopi Kumar.