|
I don't see anything...
Are you at least getting an empty replay.txt file when you exit the app or the dg_scenario
destructor is called (actually it should exist as soon as the
ofstream dg_scenario::dg_video<br />
("replay.txt", ios::out); line is executed at startup)?
If you put a breakpoint on
ofstream dg_scenario::dg_video("replay.txt", ios::out);
and run the app, is dg_scenario::dg_video constructed properly?
I'm not sure what's going on - I'm testing here with equivalent code and it works fine.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
This episode brought to you by the letter Z
|
|
|
|
|
Also, if you add a flush call to the constructor after the last text is written
so it looks like this:
dg_scenario::dg_video << "-- SENSOR INFORMATION --\n\n";<br />
dg_scenario::dg_video.flush();
and put a breakpoint on the line calling flush(), the replay.txt file should have text in it
after flush is called.
If you're not seeing any "replay.txt" file at all, then you may want to specify a path with the
name so you can find it
Mark
Mark Salsbery
Microsoft MVP - Visual C++
This episode brought to you by the letter Z
|
|
|
|
|
OK. I put a breakpoint on the line in the constructor which enters the first line of text and added the flush() at the end of the constructor. I stepped through all the lines and after passing flush(), opened the replay.txt file. The text had been entered successfully!!
HOWEVER, (after I remove that same flush() statement) if I run through the whole application, trigger the constructor and destructor, and then check the replay.txt file, I don't find anything..
any ideas why?
--
dg
|
|
|
|
|
moonraker928 wrote: after passing flush(), opened the replay.txt file. The text had been entered successfully!!
Progress!
moonraker928 wrote: HOWEVER, (after I remove that same flush() statement) if I run through the whole application, trigger the constructor and destructor, and then check the replay.txt file, I don't find anything..
Hmm...you still have a call to flush in the destructor, right?
And if you put a breakpoint there you can confirm it's getting called?
Like I mentioned, the output is buffered, so until the ofstream object is destructed (where it
flushes and closes the file) or you flush and/or close the file, your output may be sitting in a
memory buffer. Once the flush() and/or close() methods get called then there should be text in
the file.
For immediate writes to the file (while it's open) you need to call flush().
Mark
Mark Salsbery
Microsoft MVP - Visual C++
This episode brought to you by the letter Z
|
|
|
|
|
I Agree with Mark here, what's more I discovered a long time ago, and at great expense at the time that files are not flushed when you hit a breakpoint. Best to flush frequently.
NB Got used to Bracketing these flushings in WIN 3.1 and FAT with #ifdef _DEBUG etc. Found that with NTFC it makes little performance difference
LateNightsInNewry
|
|
|
|
|
OK. I added a flush() statement after every group of lines that reads in text to the file and it worked!
The text file has all the data that I want.
Thanks a lot everyone!
--
dg
|
|
|
|
|
You should probably be using endl instead of \n . Otherwise, caching might be a problem.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I have a Visual C++ MFC application, and I'm trying to add the ability to have a new Outlook mail message window pop up with some information filled in, just like what happens when you click an email link in a webpage and it opens up a new email message in your default mail client. I have code that (using MAPI) lets me actually send an email automatically through Outlook, but I want this to have the message window pop up and not get sent until the user clicks the send button. Any ideas? Thanks.
|
|
|
|
|
What happens with:
ShellExecute(..., "open", "mailto:jbaird1@company.com?Subject=Test&Body=Unconventional", ...);
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Wow that worked perfectly. Thanks very very much!
|
|
|
|
|
Hi all,
I'm populating a CString with a set of int's however if the int is less than 10 I want to put a 0 (zero) before it.
At present I'm populating the CString by using the format method, so my code looks something like:
myString.Format ( "%d, %d, %d", int1, int2, int3) ;
I though maybe using the float method I could force a preceding zero but that hasn't worked, my code is below:
myString.Format ( "%2.0d, %d, %d", int1, int2, int3) ;
does anyone know how to do this?
cheers,
|
|
|
|
|
figured it out, just needed to do:
myString.Format ( "%02d, %02d, %02d", int1, int2, int3) ;
btw does anyone know the term for doing this?
|
|
|
|
|
mcsherry wrote: btw does anyone know the term for doing this?
The term? The 0 is a flag directive, and the 2 is the width.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hello all
I am beginner in C++, and I am studying now ISO/ANSI C++, making Console application, and I have some problems with escape characters like "\a" and "\b"
both of them not working on my console
if any one can help, plz send to me
Best Regards
|
|
|
|
|
A-M-S-S wrote: and I have some problems with escape characters like "\a" and "\b"
both of them not working on my console
Define "not working."
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I mean I heard no sound using \a
and when I used
cout<<"abcd\b";
it prints abcd, and my understanding is that it should be print "abc"
|
|
|
|
|
Have you tried printf() instead of cout ?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
yes I had tried,
but still got no sound with "\a"
but I discovered something when I tried "\b"
both cout and printf do the functionality of the escape character \b as soon as there is no new line after printing "\b"
is there any one have an answer for those 2 problems
|
|
|
|
|
A-M-S-S wrote: but still got no sound with "\a"
Do you actually have a beeper, not a speaker, for the sound to come though?
What exactly are you doing that requires the use of a backspace?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I don't want to do any thing specific, I am just trying to learn c++, and try every concept,
and till now I couldn't able to hear any beep in my speaker
|
|
|
|
|
Hi all:
Does anyone ever use clapack with VS2005.NET? It's really pain, I have spent a whole day on it but I still can't make it work. Here is what I have done and the problems, could anyone help me out please?
First I copied files "clapack.lib, libF77.lib, libI77.lib, blas.lib" to the "..\Microsoft Visual Studio 8\VC\PlatformSDK\lib" directory, the header files "clapack.h, f2c.h, blaswrapper.h" to the "..\Microsoft Visual Studio 8\VC\PlatformSDK\Include" directory.
I copied the sample code from the website of clapack faq 1.9. I added the input libraries to the project by setting the \project\linker\input property.
When compile the program, I got the following errors:
1>main.obj : error LNK2019: unresolved external symbol "int __cdecl dgesvd_(char *,char *,long *,long *,double *,long *,double *,double *,long *,double *,long *,double *,long *,long *)" (?dgesvd_@@YAHPAD0PAJ1PAN122121211@Z) referenced in function _main
1>D:\Project\VS2005\clapack_test\CLapack_test\Debug\CLapack_test.exe : fatal error LNK1120: 1 unresolved externals
Can anyone help me please???
Thanks very very much!!!
Asura
|
|
|
|
|
I want up , down , left and right arrow keys codes to use in bVk of Keybd_Event API function , but i don't know the codes . could anyone help me ?
|
|
|
|
|
VK_LEFT, VK_UP, ...
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
|