473,407 Members | 2,598 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Problem which ifstream and ofstream class in VC++

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
Jul 22 '05 #1
2 4038
Armando wrote:

#include<fstream.h>
Drop the .h!
#include<string>
using namespace std;


--
Attila aka WW
Jul 22 '05 #2
On Fri, 23 Jan 2004 06:48:59 -0800, Armando wrote:
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
Jul 22 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Brandon McCombs | last post by:
This may be the wrong group but I didn't see anything for VC++ so I'm trying here. I have a C++ book by Deitel and Deitel that says I can use fstream File("data.dat", ios::in | ios::out |...
1
by: Jaime Montes | last post by:
I have found that adding in the start of the file the character '-1' and '-2' I can read the file as a Unicode, and to write any character I have to write pairs of character so for 'a' I write '0'...
11
by: David Briggs | last post by:
I am using MFC VC++ 6.0 and I have a simple class 'Data' with a CString member var. Name. I added operator << and >> as: #include <istream> #include <ostream> #include <fstream> ...
7
by: shawn | last post by:
Hi All, Am using MSVC6 compiler on a WinXP machine. Am trying to read a file using std::ofstream; the problem is that Tofstream.is_open() fails and Tifstream.rdstate() returns "2" which...
2
by: Assertor | last post by:
Hi, All. (VC++6.0) I found some strange thins when using getline() and seekg() of std::ifstream. After the file position of an open file was shift to the end of the file, seekg() did not...
2
by: Karl | last post by:
Hey everyone! I've got a quick question on whether std::ifstream is buffered or not. The reason is that I have a homework assignment that requires me to benchmark copying files using different...
3
by: MariyaGel | last post by:
I have wrote the program and it worked fine until I had to include one more array into it. As you can see below the two arrays of volume and mass are working properly now I need to include a third...
4
by: marathoner | last post by:
I tried your advice, and replaced "ifstream" with "std::ifstream". I also replaced instances of "ofstream" with "std::ofstream". Those syntax errors were resolved. When I added "std" to the...
11
by: adramolek | last post by:
So... I'm trying to get used to using C++ ifstream (or ofstream) instead of stdio (although I'm having second thoughts). Anyways, I want to be able to display a meaningful error message if ifstream...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.