Guest_imported
New member
- Jan 1, 1970
- 0
I am doing some work in which I am trying to use strings and
substrings. Also, I need to read and write to files as well. However
there seems to be conflict such that I cannot do both at the same
time. The part of the code giving the error is as below:
#include <iostream.h>
#include <fstream.h>
#include <iomanip.h>
#include <stdlib.h>
#include <string>
using namespace std;
main()
{
//variable definitions
char* folder1;
char* folder2;
char data[20] = "christopher";
ofstream outfile;
ifstream inputfile;
string state;
string region;
string item8;
string item5a;
string item5b;
string item5c;
string item5d;
string item5e;
string item2
}
The error messages are:
'ofsteam': ambiguous symbol
'ifstream': ambiguous symbol
However the error goes away if I get rid of the "namespace std" line.
But once I get rid of that line, then all the string data type
definitions will generate an error. How do I get around that so as to
be able to use both.
Thanks
Chris
substrings. Also, I need to read and write to files as well. However
there seems to be conflict such that I cannot do both at the same
time. The part of the code giving the error is as below:
#include <iostream.h>
#include <fstream.h>
#include <iomanip.h>
#include <stdlib.h>
#include <string>
using namespace std;
main()
{
//variable definitions
char* folder1;
char* folder2;
char data[20] = "christopher";
ofstream outfile;
ifstream inputfile;
string state;
string region;
string item8;
string item5a;
string item5b;
string item5c;
string item5d;
string item5e;
string item2
}
The error messages are:
'ofsteam': ambiguous symbol
'ifstream': ambiguous symbol
However the error goes away if I get rid of the "namespace std" line.
But once I get rid of that line, then all the string data type
definitions will generate an error. How do I get around that so as to
be able to use both.
Thanks
Chris