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

strings manipulations and file pointers

Status
Not open for further replies.

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] = &quot;christopher&quot;;
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 &quot;namespace std&quot; 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
 
Use <fstream> not fstream.h and read about using namespace std; You might want to do that for iostream as well.

-bitwise
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top