Old compiler on XP

B

Brian Dude

Hello, I only recently upgraded my computer and installed Windows XP (new
hard drive as well). So I installed my good ol' Borland C++ 4.52 software
and wanted to get back to one of my old DOS programs. The program
(GRAPH.EXE) takes an algebraic expression as a command-line arguement, i.e:

graph x^2-2*x+5

However, the command prompt seems to ignore the '^' symbol and generates an
error. I was curious why, so I created a quick program to simply echo
argv[1] (well the first three characters anyway), and the character wasn't
even stored. It just showed:

x2

(for argv[1][0], and argv[1][1] respectively). Why is this happening?

TIA,
Brian Dude
 
V

Val

Very, very strange.

Using Visual Studio 2003's C++, I wrote a program to simply display the arg
string. The same result occurs when the program is run directly from a
command prompt - the ^ is not part of the arg string passed to the program.
Curiously, when the program is run from within Visual Studio (in debugging
mode), the ^ is present!!

It may not be a wholly satisfactory soultion, but if your argument string is
placed inside double quotes, it will be delivered intact to the program, as
in :
C:> graph "x^2"

-- OK, a little futher digging: ^ is the escape code for command shell!. To
display ^, use ^^.

See:
http://www.microsoft.com/resources/...docs/en-us/ntcmds_shelloverview.mspx?mfr=true
(about 3/4 way down in the explanation of Setting Environment Variables. )

Val
 
B

Brian Dude

Val said:
Very, very strange.

Using Visual Studio 2003's C++, I wrote a program to simply display the
arg string. The same result occurs when the program is run directly from
a command prompt - the ^ is not part of the arg string passed to the
program. Curiously, when the program is run from within Visual Studio (in
debugging mode), the ^ is present!!

It may not be a wholly satisfactory soultion, but if your argument string
is placed inside double quotes, it will be delivered intact to the
program, as in :
C:> graph "x^2"

-- OK, a little futher digging: ^ is the escape code for command shell!.
To display ^, use ^^.

See:
http://www.microsoft.com/resources/...docs/en-us/ntcmds_shelloverview.mspx?mfr=true
(about 3/4 way down in the explanation of Setting Environment Variables. )

Val

That does help. Thank you!
Brian
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top