Click here to Skip to main content
15,888,968 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Cannot access ClassView information file error msg Pin
David Crow11-Jul-07 10:48
David Crow11-Jul-07 10:48 
GeneralRe: Cannot access ClassView information file error msg Pin
cgb14311-Jul-07 11:02
cgb14311-Jul-07 11:02 
QuestionText Updation Pin
Abhijeet Pathak11-Jul-07 9:56
Abhijeet Pathak11-Jul-07 9:56 
QuestionRe: Text Updation Pin
Mark Salsbery11-Jul-07 10:19
Mark Salsbery11-Jul-07 10:19 
AnswerRe: Text Updation Pin
David Crow11-Jul-07 10:28
David Crow11-Jul-07 10:28 
AnswerRe: Text Updation Pin
Abhijeet Pathak11-Jul-07 10:48
Abhijeet Pathak11-Jul-07 10:48 
GeneralRe: Text Updation Pin
Mark Salsbery11-Jul-07 11:03
Mark Salsbery11-Jul-07 11:03 
Questionifstream - reading same data over and over Pin
moonraker92811-Jul-07 9:34
moonraker92811-Jul-07 9:34 
Background:
I have two streams, one that writes to a text file called replay.txt, and one that reads from replay.txt. Both events occur while my app is running. So the basic architecture is that while I am simulating something, the app is writing to replay.txt keep track of position of objects and sensors and isDone is false. When the simulation is complete, isDone is true, and the app reads from replay.txt and uses the data in the file to replicate the simulation (like a replay video). dg_replay is the stream that reads from the file. Following the the text file data:

replay.txt
---------
dg_bead
-15
5
5
1
0
dg_grasper
0
0
0
0

Problem: In line marked (A), the values read into x,y,z,d,ts are -15,5,5,1,0 respectively. Then i++ which means that that (i=0) stuff is not going to be processed again. The next process is going to be in the else clause which reads in x,y,z,ss. Now logically, as i would think, the next four numbers should be 0,0,0,0 respectively in those variables. However the data read in to x,y,z,ss is also -15,5,5,1,0!! The same data is read twice..WHY??!

code:
(note #1: i have initialized all variables in the beginning of the file - not shown)
(note #2: this code snippet is part of a function that is called every 1/30th of a second which basically makes this part of a loop)
-----
if (isDone) {
cerr << "eof: " << dg_replay.eof() << "\n";
if (!dg_replay.eof()) {
if (i == 0) { // signals the app to read in the initial states in the file
dg_scenario::dg_video.close();
dg_scenario::video = 1;
if (dg_replay.is_open()) dg_replay.getline(tool_name,256);
(A) dg_replay >> x >> y >> z >> d >> ts;
universe->findObject(tool_name)->CenterObject();
universe->findObject(tool_name)->Translate(x,y,z);
universe->findObject(tool_name)->setDynamicsInt(d);
universe->findObject(tool_name)->being_grabbed = ts;
dg_replay.getline(tool_name,256);
} else {
// process sensor stuff - PROBLEM: reading in the same #s (-15,5,5,) everytime...
(B) dg_replay >> x >> y >> z >> ss;
xyz.x = x; xyz.y = y; xyz.z = z;
left_down = ss; // mouse sensor state - if left_down is 0, then its false and forcep is open etc..
}
i++;
} else {
i = -1;
dg_replay.close();
}
}

--
dg
AnswerRe: ifstream - reading same data over and over Pin
Mark Salsbery11-Jul-07 10:23
Mark Salsbery11-Jul-07 10:23 
GeneralRe: ifstream - reading same data over and over Pin
moonraker92811-Jul-07 11:00
moonraker92811-Jul-07 11:00 
GeneralRe: ifstream - reading same data over and over Pin
moonraker92811-Jul-07 11:27
moonraker92811-Jul-07 11:27 
GeneralRe: ifstream - reading same data over and over Pin
Mark Salsbery11-Jul-07 11:37
Mark Salsbery11-Jul-07 11:37 
QuestionGetting the Tag Property to work for me Pin
InOut.NET11-Jul-07 7:53
InOut.NET11-Jul-07 7:53 
QuestionUSB device message detector Pin
Beveloper11-Jul-07 7:00
Beveloper11-Jul-07 7:00 
AnswerRe: USB device message detector Pin
ksrameshkanth11-Jul-07 21:59
ksrameshkanth11-Jul-07 21:59 
QuestionCut a bitmap under GDI+ Pin
Chen-XuNuo11-Jul-07 6:36
Chen-XuNuo11-Jul-07 6:36 
AnswerRe: Cut a bitmap under GDI+ Pin
Mark Salsbery11-Jul-07 9:04
Mark Salsbery11-Jul-07 9:04 
GeneralRe: Cut a bitmap under GDI+ Pin
Chen-XuNuo11-Jul-07 19:36
Chen-XuNuo11-Jul-07 19:36 
GeneralRe: Cut a bitmap under GDI+ Pin
Mark Salsbery12-Jul-07 5:08
Mark Salsbery12-Jul-07 5:08 
QuestionHelp aout paint none-client area Pin
kcynic11-Jul-07 6:22
kcynic11-Jul-07 6:22 
AnswerRe: Help aout paint none-client area Pin
DevMentor.org12-Jul-07 12:01
DevMentor.org12-Jul-07 12:01 
GeneralRe: Help aout paint none-client area Pin
kcynic13-Jul-07 1:00
kcynic13-Jul-07 1:00 
GeneralRe: Help aout paint none-client area Pin
DevMentor.org13-Jul-07 12:10
DevMentor.org13-Jul-07 12:10 
GeneralRe: Help aout paint none-client area Pin
kcynic13-Jul-07 12:26
kcynic13-Jul-07 12:26 
GeneralRe: Help aout paint none-client area Pin
DevMentor.org13-Jul-07 20:46
DevMentor.org13-Jul-07 20:46 

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.