Problem which ifstream and ofstream class in VC++

A

Armando

i write one programm in vc++ but the compiler say that i use ambiguous
symbol,i don´t know why ? how can do to tell the compiler that is ok
so ? i become this error message:

error C2872: 'ifstream' : ambiguous symbol
error C2872: 'ofstream' : ambiguous symbol
error C2065: 'fileread' : undeclared identifier
error C2228: left of '.open' must have class/struct/union type
error C2228: left of '.eof' must have class/struct/union type

there is my sourcecode.
i should be very if i become some idee.
thank 4 u help

#ifndef _XML_H
#define _XML_H

#include<fstream.h>

#include<string>
using namespace std;

class XML
{
private:

ifstream fileread;
ofstream filewrite;

public:

// For reading file and inserting the key and value pairs into
XML file
static void readfile(char *infile,string key1,string
text1,string str_value,string val);

// Function for converting the function parameters into XML file
static void writeXML(char *infile,string val,char *path);

// retrieving the value
string getValue(char *infile,char *path);


};


#endif // _XML_H
 
M

Martijn Lievaart

i write one programm in vc++ but the compiler say that i use ambiguous
symbol,i don´t know why ? how can do to tell the compiler that is ok
so ? i become this error message:

*sigh* why does this question suddenly come up thrice a day.

It is because you are mixing old style (fstream.h) and new style (string)
headers. Older MSVC (dunno about the newer ones) cannot handle this well.
Use fstream instead of fstream.h.

HTH,
M4
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,077
Latest member
SangMoor21

Latest Threads

Top