473,386 Members | 1,706 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,386 software developers and data experts.

what is different between <fstream.h> and <fstream>MS VC++

Hallo !

I habe some error in my programm,because i use <fstream.h>,I want to
use <fstream> but i donīt know which fonctions i must modify in my
program ?

Thanks you for your help.

Armando.
Jul 22 '05 #1
6 3181

"Armando" <ar***********@yahoo.fr> wrote in message
news:a3**************************@posting.google.c om...
Hallo !

I habe some error in my programm,because i use <fstream.h>,I want to
use <fstream> but i donīt know which fonctions i must modify in my
program ?

Thanks you for your help.


What are the errors?
Are you writing 'using namespace std;' in your program?
Jul 22 '05 #2
"Sharad Kala" <no*****************@yahoo.com> wrote in message news:<bv************@ID-221354.news.uni-berlin.de>...
"Armando" <ar***********@yahoo.fr> wrote in message
news:a3**************************@posting.google.c om...
Hallo !

I habe some error in my programm,because i use <fstream.h>,I want to
use <fstream> but i donīt know which fonctions i must modify in my
program ?

Thanks you for your help.


What are the errors?
Are you writing 'using namespace std;' in your program?


yes i am writing 'using namespace std ;' and the errors are

error C2228: left of '.open' must have class/struct/union type
error C2228: left of '.eof' must have class/struct/union type
error C1903: unable to recover from previous error(s); stopping
compilation
Error executing cl.exe.

and my header file is here:

#ifndef _XML_H
#define _XML_H

#include<fstream>
#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 #3
Armando wrote:

"Sharad Kala" <no*****************@yahoo.com> wrote in message news:<bv************@ID-221354.news.uni-berlin.de>...
"Armando" <ar***********@yahoo.fr> wrote in message
news:a3**************************@posting.google.c om...
Hallo !

I habe some error in my programm,because i use <fstream.h>,I want to
use <fstream> but i donīt know which fonctions i must modify in my
program ?

Thanks you for your help.


What are the errors?
Are you writing 'using namespace std;' in your program?


yes i am writing 'using namespace std ;' and the errors are

error C2228: left of '.open' must have class/struct/union type
error C2228: left of '.eof' must have class/struct/union type


those errors don't seem to be related to either the fstream header
or the ifstream header.

The error message looks like VC++ generated it. If so there is a line
number next to it. What line does it refere to?
--
Karl Heinz Buchegger
kb******@gascad.at
Jul 22 '05 #4
Armando <ar***********@yahoo.fr> wrote in message
news:a3*************************@posting.google.co m...
"Sharad Kala" <no*****************@yahoo.com> wrote in message news:<bv************@ID-221354.news.uni-berlin.de>...
"Armando" <ar***********@yahoo.fr> wrote in message
news:a3**************************@posting.google.c om...
Hallo !

I habe some error in my programm,because i use <fstream.h>,I want to
use <fstream> but i donīt know which fonctions i must modify in my
program ?

Thanks you for your help.


What are the errors?
Are you writing 'using namespace std;' in your program?


yes i am writing 'using namespace std ;' and the errors are

error C2228: left of '.open' must have class/struct/union type
error C2228: left of '.eof' must have class/struct/union type
error C1903: unable to recover from previous error(s); stopping
compilation
Error executing cl.exe.

and my header file is here:

#ifndef _XML_H
#define _XML_H

#include<fstream>
#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


You probably used a pointer to an ifstream object as an ifstream object.
For example:

ifstream *pifs;
....
pifs.open("xmldata.xml");

or used a whatever object that wasn't an ifstream.
Jul 22 '05 #5
> > > I habe some error in my programm,because i use <fstream.h>,I want to
use <fstream> but i donīt know which fonctions i must modify in my
program ?

yes i am writing 'using namespace std ;' and the errors are

error C2228: left of '.open' must have class/struct/union type
error C2228: left of '.eof' must have class/struct/union type
error C1903: unable to recover from previous error(s); stopping
compilation
Error executing cl.exe.

and my header file is here:


#include <iostream>
#include<fstream>
#include<string>

(etc.)

You might find that you need
#include <istream>
and/or
#include <ostream>
too.
Jul 22 '05 #6
ol*****@inspire.net.nz (Old Wolf) wrote in message news:<84**************************@posting.google. com>...
> I habe some error in my programm,because i use <fstream.h>,I want to
> use <fstream> but i donīt know which fonctions i must modify in my
> program ?


yes i am writing 'using namespace std ;' and the errors are

error C2228: left of '.open' must have class/struct/union type
error C2228: left of '.eof' must have class/struct/union type
error C1903: unable to recover from previous error(s); stopping
compilation
Error executing cl.exe.

and my header file is here:


#include <iostream>
#include<fstream>
#include<string>

(etc.)

You might find that you need
#include <istream>
and/or
#include <ostream>
too.

//================================================== ============================
Thanks you everybody
i am writting 2 programs in VC++ 6.0, one for XML files the header is
up i have no problem which them it is ok, and the second programm is a
dynamic table to memory some data typ is ok. but i want to put the
both pragrams together (2 classes in 1) and i donīt any code of
program and try to compile alone the xml.cpp file and i become this
errors.

Compiling...
xml.cpp
\config\xml.cpp(164) : error C2228: left of '.open' must have
class/struct/union type
config_xml_1\config\xml.cpp(167) : error C2228: left of '.eof' must
have class/struct/union type
config_xml_1\config\xml.cpp(167) : fatal error C1903: unable to
recover from previous error(s); stopping compilation
Generating Code...
Compiling...
Config.cpp
Generating Code...
Error executing cl.exe.

Config.exe - 3 error(s), 0 warning(s)
#================================================= ==============================
here are the errors line from the xml.cpp

the first ==> fileread.open(infile,ios::in);

the second ==> while(!fileread.eof())

#================================================= ==============================
here are the headers of the both programs.
#================================================= ==============================
#ifndef _XML_H
#define _XML_H

#include<fstream>
#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

#================================================= ==============================
#ifndef _Config_h
#define _Config_h

#include <dynamictable.h>
#include <strings.h>

class Config {

private:

DynamicTable<String *> Values ;

String filename , path ;

public:

// StandardKonstruktor
Config();
// Konstruktor
Config (String , String);
// Desrtruktor
~Config();

// PutString -- Put a string value (true string) into the DynamicTable
char* PutString(String Key, String Value);
// void PutString(String Key, String Value);
// GetString -- Get a string value (true string) from the DynamicTable
String GetString (String Key);

// PutColor -- Put a color value into the DynamicTable
void PutInt(String key , int value);

// PutFloat -- Put a color value into the DynamicTable
void PutFloat (const char * Name, double Value);

// PutColor -- Put a color value into the DynamicTable
void PutColor (const char * Name, const COLORREF Value = 0);

// GetFloat -- Get a floating-point value from the DynamicTable
double GetFloat (String key);

// GetInt -- Get a Int value from the DynamicTable
int GetInt (String key);

// GetColor -- Get a color (COLORREF) value from the DynamicTable
COLORREF GetColor(String key);

// Save the value
void save ();

};
#endif // Config_h

#================================================= ==============================

THX

Armando
Jul 22 '05 #7

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

Similar topics

6
by: David Briggs | last post by:
I am using MS VC++ 6.0 with MFC I have a simple class: #include <fstream.h> class Data { public: CString WriteStr(); Data();
5
by: Hendrik Schober | last post by:
Hi, I had originally suspected this to be a bug in the std lib, that's why I started a thred in the STL newsgroup. However, it seems as if it is a compiler bug, so I'm transfering it to here....
6
by: Dave | last post by:
In .Net 2003 if a line, read from a text file is larger than a size parameter, the ifstream getline(buff, sze) put the file pointer to the EOF, so next peek() returns EOF. I saw this problem...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.