[Techtalk] Re: getline bug or doing it all wrong g++
John Clarke
johnc+linuxchix at kirriwa.net
Tue Mar 2 23:24:02 EST 2004
On Tue, Mar 02, 2004 at 01:06:50 -0800, Tintin J Marapao wrote:
> I actually didn't declare it that way; Sorry about the sloppiness. I
> actually had an array of char*s and meant to say the first value (index
> of 0) in the char *test[];
I'm sorry, I don't understand what you're trying to say. Why don't you
post the actual code you're using? It'll be much easier to help if you
do that.
> I guess it should go :
>
> char *test = "hello world";
> ifstream in;
> (!in.eof())
> ...
> cout << test << endl; //correct result - prints hello world
> in.getline( line, delimiters);
> cout << test << endl; // prints the value of line!!
That still doesn't help. How did you declare line? If it was simply a
char pointer, did you initialise it? What's the definition of
delimiters? Give me code that compiles and links but doesn't work
and it'll be a lot easier to spot the problem.
> Thanks anyway!
I'm happy to help, but I'd be even happier with the actual code that
doesn't work :-)
Cheers,
John
--
> after [6809 assembler], C++ was like programming in a rat maze while
> blindfolded and wearing a straitjacket
What do you mean "after that"? That's what C++ *is* like.
-- Peter da Silva
More information about the Techtalk
mailing list