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

From: Armando (armandopoulos_at_yahoo.fr)
Date: 01/29/04


Date: 29 Jan 2004 01:01:17 -0800

oldwolf@inspire.net.nz (Old Wolf) wrote in message news:<843a4f78.0401281211.20b94325@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



Relevant Pages

  • Re: how to replace a substring in a string using C?
    ... Well spotted - no one else caught that one (I only picked it up after Dave ... strlen on the entire original string where possible - I posted a similar ... are some typical results (using the same compilation options as you except ... The optimisation of not calling strlen on the entire string cuts about 7% ...
    (comp.lang.c)
  • Re: Performance RPG Figurative Constants versus Literals
    ... in compilation times between the two methods, ... I would suspect that the compiler would store *blanks as a single byte ... I would also suspect that comparing ... a 132 character string to a figurative constant would be quicker in the ...
    (comp.sys.ibm.as400.misc)
  • Re: Turbo Tax 2008 will not launch on XP Pro
    ... bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String ... (String key, String defaultValue) ...
    (microsoft.public.windowsxp.general)
  • Re: Turbo Tax 2008 will not launch on XP Pro
    ... bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String ... (String key, String defaultValue) ...
    (microsoft.public.windowsxp.general)
  • Re: Turbo Tax 2008 will not launch on XP Pro
    ... location "TY08" is being written to the log file. ... bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String ...
    (microsoft.public.windowsxp.general)