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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

istrstream issues

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hi - I have had an error that's been driving me nuts all day! Any help would be greatly appreciated. I have already exhausted all internet searches for help with this topic in spite of similar articles but i can't seem to get this exact instance of my error resolved.

By the way, this code compiled perfectly on unix but i am pasting it into visual c++ and this is the only error i am really getting. from what i can tell, it is a minor bug. i need the fix!

The issue at hand:

#include <strstrea.h>

FileInfo parseLine(string & line)
{
istrstream curLine(line.c_str());
}

//this line gives me error C2664: '__thiscall istrstream::istrstream(char *)' : cannot convert parameter 1 from 'const char *' to 'char *'
Conversion loses qualifiers


how can i fix this?? Thanks so much for any help.

Melissa

istemp@kramerlevin.com
 
Try this... though i dont think it will work. line.c_str returns a constant string.

FileInfo parseLine(string & line)
{
istrstream curLine((char*)line.c_str());
}

maybe try this instead

FileInfo parseLine(string & line)
{
char buffer [256];
istrstream curLine(buffer);
line = buffer;
}


Matt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top