Board index » cppbuilder » header file explicitly?

header file explicitly?


2008-01-24 07:02:52 AM
cppbuilder0
Please....
Newbie here, _days_ of effort:
All I want to do is get a number from a text file (hence it's a char) and
turn it into a number ( a double ).
I have a working C++ program ("it8fast.exe") that I wrote and dare not
modify.
(I don't want to extern C, I don't want to remove "using namespace std;" )
That program spits the text file.
I'm trying to write a function that reads that file and puts the numbers
back _into_ the program.
(I did all this years ago in Python. Python is slow. I rewrote the program
in C++ for speed and protability, except for the graphics (was VPython) and
the filereader (C++ was so vicious to me that I didn't try back then).)
I can read the file and parse it with getline().
Using getline()'s third parameter I can get the piece of the file I want and
put it into a variable, as a _string_. This works (compiles, runs), _in
isolation_. DOS box output is correct.
Using strtod() I can make a string that I _manually write_ into the source,
become a double.
_That_ works, in isolation. DOS box output is correct, arithmetic works.
I cannot get the compiler to do both at once.
I get error E2285, "cannot find a match for <various incomprehensible stuff
here>in (blah, blah)".
The stuff in <>is _different_ depending on which way I choose to try to
put the two above pieces of the function together. One way, it refers to
getline() as cause, the other way it refers to strtod() being the cause.
_What_ is it trying to "match"?
My best guess after days of webbing (codegear, various C++ URLs) is that by
using one of these --a C++ function-- the compiler thinks what when I want
the other one (a C function?), it needs to look into the same header (or
lib) as for the first; it does; doesn't find it ('cause it's in a different
header/lib), and {*word*88}s. This would explain why I get a different error
message depending on which way I write the source with both functions in it.
Hence my question: how in C++ would I _explicitly_ call these functions from
their different header files?
I know for the standard one, I'd call it with std::, but no header file is
named "std" so how would I find out what the keyword is to call from the
other (or any desired) header?
(Of course, I could be wrong about this, and there's no way, in which case
I'd have to go back to searching for a simple way (it has to operate in a
while loop with several other conditonal items in each iteration) to do this
in pure C++. The main program is written in C++ with "using namespace std;"
and no "extern C", and I dread, dread, dread having to go all through that
and change all the calls that want "std::" .or messing up its looks with the
extern C { pgm } thingie when nothing else in the program needs it...)
Thanks.
If anyone knows an easy C++ way to use getline() and _then_ turn the string
extracted into a double, I'd sure appreciate it.
Peace
JB
XXXX@XXXXX.COM
Web: tetrahedraverse.com
 
 

Re:header file explicitly?

This is not a top-post.
(*g*)
Problem has been resolved.
Thanks anyway.
(same me :
"John Brawley" < XXXX@XXXXX.COM >wrote in message
Quote
Please....
Newbie here, _days_ of effort:
All I want to do is get a number from a text file (hence it's a char) and
turn it into a number ( a double ).

I have a working C++ program ("it8fast.exe") that I wrote and dare not
modify.
(I don't want to extern C, I don't want to remove "using namespace std;" )

That program spits the text file.
I'm trying to write a function that reads that file and puts the numbers
back _into_ the program.

(I did all this years ago in Python. Python is slow. I rewrote the
program
in C++ for speed and protability, except for the graphics (was VPython)
and
the filereader (C++ was so vicious to me that I didn't try back then).)

I can read the file and parse it with getline().
Using getline()'s third parameter I can get the piece of the file I want
and
put it into a variable, as a _string_. This works (compiles, runs), _in
isolation_. DOS box output is correct.

Using strtod() I can make a string that I _manually write_ into the
source,
become a double.
_That_ works, in isolation. DOS box output is correct, arithmetic works.

I cannot get the compiler to do both at once.
I get error E2285, "cannot find a match for <various incomprehensible
stuff
here>in (blah, blah)".
The stuff in <>is _different_ depending on which way I choose to try to
put the two above pieces of the function together. One way, it refers to
getline() as cause, the other way it refers to strtod() being the cause.
_What_ is it trying to "match"?

My best guess after days of webbing (codegear, various C++ URLs) is that
by
using one of these --a C++ function-- the compiler thinks what when I want
the other one (a C function?), it needs to look into the same header (or
lib) as for the first; it does; doesn't find it ('cause it's in a
different
header/lib), and {*word*88}s. This would explain why I get a different error
message depending on which way I write the source with both functions in
it.

Hence my question: how in C++ would I _explicitly_ call these functions
from
their different header files?

I know for the standard one, I'd call it with std::, but no header file is
named "std" so how would I find out what the keyword is to call from the
other (or any desired) header?

(Of course, I could be wrong about this, and there's no way, in which case
I'd have to go back to searching for a simple way (it has to operate in a
while loop with several other conditonal items in each iteration) to do
this
in pure C++. The main program is written in C++ with "using namespace
std;"
and no "extern C", and I dread, dread, dread having to go all through that
and change all the calls that want "std::" .or messing up its looks with
the
extern C { pgm } thingie when nothing else in the program needs it...)

Thanks.
If anyone knows an easy C++ way to use getline() and _then_ turn the
string
extracted into a double, I'd sure appreciate it.


Peace
JB
XXXX@XXXXX.COM
Web: tetrahedraverse.com