April 27, 2002
I'm writing a very basic io function one for loading and one for saving.

Load:

   fstream infile;

   infile.open (szFile, fstream::in );

 // All variables go here

infile.getline(szName,40) ;
infile.getline(szRace,30) ;
infile.getline(szSex,10) ;


Save:

   fstream outfile;

   outfile.open (szFile, fstream::out );

 // All variables go here


outfile << szName  << endl;
outfile << szRace   << endl;
outfile << szSex   << endl;
outfile << szHandeness   << endl;
outfile << szBirthCircumstance   << endl;
outfile << szLegit   << endl;


The problem I have is that szName loads properly, but the next variable (szRace)ends up loading the string for szLegit minus the first character!

What the heck am I doing wrong?

Thanks
Steve



April 29, 2002

Steve & Denise De Chellis a écrit :

> I'm writing a very basic io function one for loading and one for saving.
>
> Load:
>
>    fstream infile;
>
>    infile.open (szFile, fstream::in );
>
>  // All variables go here
>
> infile.getline(szName,40) ;
> infile.getline(szRace,30) ;
> infile.getline(szSex,10) ;
>
> Save:
>
>    fstream outfile;
>
>    outfile.open (szFile, fstream::out );
>
>  // All variables go here
>
> outfile << szName  << endl;
> outfile << szRace   << endl;
> outfile << szSex   << endl;
> outfile << szHandeness   << endl;
> outfile << szBirthCircumstance   << endl;
> outfile << szLegit   << endl;
>
> The problem I have is that szName loads properly, but the next variable (szRace)ends up loading the string for szLegit minus the first character!
>
> What the heck am I doing wrong?
>
> Thanks
> Steve

may be DM correctly does no alow you to save the race as this information is useless <>

roland