| |
|
dkh
Posted in reply to Damian Dixon
| Apparently, a function name collided somehow. The error message did not help me much, in this case. Especially since I'm a total beginner.
This works...
#include <iostream>
#include <string>
void my_getline( istream& is, string& s, char d='\n' );
int main() {
string selectionString;
cout << "Please enter the text to search for: ";
my_getline( cin, selectionString );
return 0;
}
void my_getline( istream& is, string& s, char d ) {
fflush(stdin);
char getbuff[512];
is.getline(getbuff,512, d);
s = getbuff;
}
----------------------------------------------------------------
This does not work...
#include <iostream>
#include <string>
void getline( istream& is, string& s, char d='\n' );
int main() {
string selectionString;
cout << "Please enter the text to search for: ";
getline( cin, selectionString );
return 0;
}
void getline( istream& is, string& s, char d ) {
fflush(stdin);
char getbuff[512];
is.getline(getbuff,512, d);
s = getbuff;
}
Thanks for your reply. Any light you can shed would be appreciated.
----------------------------------------------------------------
Damian Dixon wrote:
>
> If you are trying to use the iostreams that come with STL you may get this problem.
>
> I would suggest using the old iostreams that comes with the compiler.
>
> If you still have a problem, can you post example code that causes the error message to occur.
>
> Regards
> Damian
>
> dkh wrote:
>
> > Warning: C:\DM\BIN\..\STL\port\stlport\stl/_string_io.h(96): non-const
> > reference initialized to temporary
> > Error: C:\DM\BIN\..\STL\port\stlport\stl/_string_io.h(96): cannot
> > generate copy constructor for class 'istream' because of private 'ios'
> >
> > My SC.INI file has CFLAGS=-Ae -Ab. I included the STL directory first in the INCLUDE variable. I have tried both the .zip and the release .gz versions of STLport from the web site. They both give the same result.
> >
> > I'm pretty pleased with DM and consider it a bargian at $25.00US.
> >
> >
|