 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Armando Guest
|
Posted: Wed Jan 28, 2004 10:18 am Post subject: 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.
|
|
| Back to top |
|
 |
Sharad Kala Guest
|
Posted: Wed Jan 28, 2004 10:28 am Post subject: Re: what is different between <fstream.h> and <fstream>MS V |
|
|
"Armando" <armandopoulos (AT) yahoo (DOT) fr> wrote
| Quote: | 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?
|
|
| Back to top |
|
 |
Armando Guest
|
Posted: Wed Jan 28, 2004 2:08 pm Post subject: Re: what is different between <fstream.h> and <fstream>MS V |
|
|
"Sharad Kala" <no.spam_sharadk_ind (AT) yahoo (DOT) com> wrote
| Quote: | "Armando" <armandopoulos (AT) yahoo (DOT) fr> wrote in message
news:a33b312c.0401280218.65a9f1be (AT) posting (DOT) google.com...
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
|
|
| Back to top |
|
 |
Karl Heinz Buchegger Guest
|
Posted: Wed Jan 28, 2004 2:14 pm Post subject: Re: what is different between <fstream.h> and <fstream>MS V |
|
|
Armando wrote:
| Quote: |
"Sharad Kala" <no.spam_sharadk_ind (AT) yahoo (DOT) com> wrote
"Armando" <armandopoulos (AT) yahoo (DOT) fr> wrote in message
news:a33b312c.0401280218.65a9f1be (AT) posting (DOT) google.com...
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
[email]kbuchegg (AT) gascad (DOT) at[/email]
|
|
| Back to top |
|
 |
Deming He Guest
|
Posted: Wed Jan 28, 2004 5:01 pm Post subject: Re: what is different between <fstream.h> and <fstream>MS V |
|
|
Armando <armandopoulos (AT) yahoo (DOT) fr> wrote
| Quote: | "Sharad Kala" <no.spam_sharadk_ind (AT) yahoo (DOT) com> wrote
"Armando" <armandopoulos (AT) yahoo (DOT) fr> wrote in message
news:a33b312c.0401280218.65a9f1be (AT) posting (DOT) google.com...
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
#include
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.
|
|
| Back to top |
|
 |
Old Wolf Guest
|
Posted: Wed Jan 28, 2004 8:11 pm Post subject: Re: what is different between <fstream.h> and <fstream>MS V |
|
|
| Quote: | 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>
| Quote: | #include<fstream
#include
(etc.) |
You might find that you need
#include
and/or
#include <ostream>
too.
|
|
| Back to top |
|
 |
Armando Guest
|
Posted: Thu Jan 29, 2004 9:01 am Post subject: Re: what is different between <fstream.h> and <fstream>MS V |
|
|
[email]oldwolf (AT) inspire (DOT) net.nz[/email] (Old Wolf) wrote in message news:<843a4f78.0401281211.20b94325 (AT) posting (DOT) google.com>...
| Quote: | 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
#include
(etc.)
You might find that you need
#include
and/or
#include
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
configxml.cpp(164) : error C2228: left of '.open' must have
class/struct/union type
config_xml_1configxml.cpp(167) : error C2228: left of '.eof' must
have class/struct/union type
config_xml_1configxml.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
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|