Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Any C/C++ programmer out there also familiar with FoxPro?

Status
Not open for further replies.

CosmoGreco

Programmer
Sep 16, 2002
13
0
0
US
Hello Dear members of Tek-Tips.

It's not long ago since I start devoting my efforts to program application using C/C++. So I am not very familiar with all its capabilities yet. I was before more involved with Visual FoxPro programming.

I need to find a way to perform a task in C++ that is easily accomplished in FP. That's why I need someone with FoxPro knowledge as well as C/C++.

I need to convert an entire arithmetic string expression to a result integer so C++ will calculate the expression for me without the need to develop a parser to track every single arithmetic operation.

In FoxPro, once I have a string with an arithmetic expression, I just do as in the following example and the result will be the final calculated expression number I want:

sVar = "10 * (10 - 5)"
iVar = &sVar

The contents of iVar after the above operation will be 50.

How do I do the same with C++?
The function atoi() will stop scanning the string right after it sees a non digit character so the example above will give me this result:

char szVar[]="10 * (10-5)";
int iVar = atoi(szVar);

The contents of iVar after the above operation will be 10 only.

Appreciate any ideas.

Regards,
Cosmo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top