Click here to Skip to main content
16,005,339 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Generalavenger_sb25//read, write data files Pin
dairiseky5-Apr-04 23:53
dairiseky5-Apr-04 23:53 
GeneralRe: avenger_sb25//read, write data files Pin
Steve S6-Apr-04 1:21
Steve S6-Apr-04 1:21 
GeneralRe: avenger_sb25//read, write data files Pin
avenger_sb256-Apr-04 11:15
avenger_sb256-Apr-04 11:15 
GeneralRe: avenger_sb25//read, write data files Pin
David Crow6-Apr-04 2:11
David Crow6-Apr-04 2:11 
GeneralRe: why binary? Pin
dairiseky6-Apr-04 2:32
dairiseky6-Apr-04 2:32 
GeneralRe: why binary? Pin
David Crow6-Apr-04 3:27
David Crow6-Apr-04 3:27 
GeneralRe: avenger_sb25//read, write data files Pin
avenger_sb256-Apr-04 11:12
avenger_sb256-Apr-04 11:12 
GeneralRe: avenger_sb25//read, write data files Pin
dairiseky6-Apr-04 23:48
dairiseky6-Apr-04 23:48 
yep is ok about binary. Yet there is still a problem. The objectA must be a const char*, that is not.
U said to me :
class A
{
public:
	double x;
	double y;
	double speed;
	double z;
};

As u can see here if I want to write the x, y, z. I could do as:
main(int argc, char *argv[])
{
	A objectA;

    fstream File;
	File.open ("test.txt", ios::binary);

	File.seekp(0);

	objectA.x=25.314;//xcoord
    objectA.y=-478.215;//ycoord
    objectA.z=34821.01;//zcoord

Up to here nothing wierd.
But then when I want to write into file I will use:
File.write(&objectA.x, sizeof(objectA.x));

And the error will be:
'class ostream &__thiscall ostream::write(const char *,int)' : cannot convert parameter 1 from 'double *' to 'const char *'
And even if I will write simply :
File.write(&objectA, sizeof(objectA));

There will still be the same error:
'class ostream &__thiscall ostream::write(const char *,int)' : cannot convert parameter 1 from 'class A *' to 'const char *'
Confused | :confused: I might have get things wrong...D'Oh! | :doh:

THX
GeneralRe: avenger_sb25//read, write data files Pin
Anonymous7-Apr-04 3:27
Anonymous7-Apr-04 3:27 
GeneralRe: avenger_sb25//read, write data files Pin
avenger_sb257-Apr-04 3:35
avenger_sb257-Apr-04 3:35 
GeneralRe: avenger_sb25//read, write data files Pin
dairiseky7-Apr-04 5:32
dairiseky7-Apr-04 5:32 
GeneralOracle Stored Procedure Problem in .NET Pin
Anonymous5-Apr-04 23:20
Anonymous5-Apr-04 23:20 
QuestionGDI+ question: Bitmap:FromFile, how to detect non-existent image file? Pin
Indrawati5-Apr-04 22:39
Indrawati5-Apr-04 22:39 
AnswerRe: GDI+ question: Bitmap:FromFile, how to detect non-existent image file? Pin
Mike Dimmick5-Apr-04 23:43
Mike Dimmick5-Apr-04 23:43 
AnswerRe: GDI+ question: Bitmap:FromFile, how to detect non-existent image file? Pin
JonCage6-Apr-04 1:37
JonCage6-Apr-04 1:37 
GeneralWindows idle time Pin
Florin Ochiana5-Apr-04 22:28
Florin Ochiana5-Apr-04 22:28 
GeneralRe: Windows idle time Pin
Rage5-Apr-04 22:35
professionalRage5-Apr-04 22:35 
GeneralRe: Windows idle time Pin
Florin Ochiana5-Apr-04 22:43
Florin Ochiana5-Apr-04 22:43 
GeneralRe: Windows idle time Pin
Rage5-Apr-04 22:48
professionalRage5-Apr-04 22:48 
GeneralRe: Windows idle time Pin
Florin Ochiana5-Apr-04 22:52
Florin Ochiana5-Apr-04 22:52 
GeneralRe: Windows idle time Pin
avenger_sb255-Apr-04 23:25
avenger_sb255-Apr-04 23:25 
GeneralRe: Windows idle time Pin
Rage6-Apr-04 0:46
professionalRage6-Apr-04 0:46 
GeneralRe: Windows idle time Pin
Antony M Kancidrowski6-Apr-04 1:37
Antony M Kancidrowski6-Apr-04 1:37 
GeneralRe: Windows idle time Pin
David Crow6-Apr-04 2:15
David Crow6-Apr-04 2:15 
GeneralRe: Windows idle time - GetLastInputInfo error Pin
Anonymous7-Apr-04 3:18
Anonymous7-Apr-04 3:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.