|
Yes, unfortunately I'm in debug mode...
Why can't the error message be a little more explicit
|
|
|
|
|
I think you had changed the settings for the debug mode.
You can try this solution:
Project-->Settings-->select Win32 Debug in "Settings For"
-->select "C/C++" tab-->select "General" in Category
-->select "Program Database for edit and continue" in "Debug Info"
then it should work normally.
Law is meaningless without chaos.
Chaos without Law is equal to destruction.
Chaos and Law create our rich and colorful world.
|
|
|
|
|
...and everything is working for the best now!
Thanks Chaos Lawful, you saved me for the second time
|
|
|
|
|
Codes described below read lines of a file and write those on another file:
CODE A:
CStdioFile ent;
CStdioFile sal;
CString stReg;
ent.Open("input.txt", CFile::modeRead);
sal.Open("output.txt", CFile::modeCreate | CFile::modeReadWrite);
while (ent.ReadString(stReg)) {
sal.WriteString(stReg);
sal.WriteString("\n");
}
runs extremely faster than:
CODE B
ifstream inp("input.txt");
ofstream outp("output.txt");
string sReg;
while(getline(inp, sReg))
salida << sReg << endl;
Is there anyway to make CODE B faster that CODE A
Thanks in advance!!!
|
|
|
|
|
> Is there anyway to make CODE B faster that CODE A
If you are only interested in copying the contents of file "input.txt" to file "output.txt", I think so.
outp << inp.rdbuf();
|
|
|
|
|
I want to make the right-arranged Tree Control.
root
|
child-|
child-|
| |
child-| |
child-|
like this..
How can I make?
-------------------------------
the Something to remind you...
Pat Metheny Group
http://my.dreamwiz.com/immk
-------------------------------
|
|
|
|
|
Hi,
I am trying to use the mscomm control within VC++, and am not being o successfull... however if I execute the same statement in VB it seems to work.. the problem is this...
in VB I issue:
Form1.MSComm1.Output = Chr(&H90)
upon doing this I immediate get a reply back in the receive buffer, also I am using a Belkin usb to serial adapter and when I look at it I can see both the send and receive light flicker quickly..
When I try and execute the code below in VC++, I never get a response and also only see the send light on the adapter flicker, never the receive as I do when executing the VB code.. This is the code within my VC++ of which I believe is doing the same as the VB..
CByteArray aBytes;
aBytes.Add( '\x90' );
COleVariant var( aBytes );
m_mscomm1.SetOutput( var );
any help would be grealy APPRECIATED...
|
|
|
|
|
We are seeking people knowledgeable in Visual C .net for a short-term freelance technical documentation role. Role involves creating tests and testing methods to measure knowledge of the subject matter. For serious inquiries send an email testcoordinator@techprofiles.com
|
|
|
|
|
Hi,
I want to left justify a CString in my Format statement. If I use a flag directive of - after % sign (myString.Format("%-35s", sName)) I thought it would get left justified but it is not. Please let me know if I am missing something.
Thanks,
|
|
|
|
|
|
Hi,
I've been using MFC to serialize my application classes for a while now, but now suddenly this error has appeared that I don't understand. I am using the CArchive::ReadObject to load my CObject based class. This function seems to run well, or has done in the past. I ran through the debugger, CArchive::ReadObject calls a function: CRuntimeClass:Load which loads a tag to the object, then load the objects name as a string. It then searches it's map for the name to find the coresponding class thingy which it uses to create the class object with. The problem is that there are far too few classes in the map, and so the function fails to find my class's name, and therefor throws an exception. Why doesn't it find my class or any others when 1) It saved fine (I've looked at the binary, and the format is correct) 2) The class is a part of the module which is doing the module 3) Yes I have used DECLARE_SERIAL and IMPLEMENT_SERIAL properly (I think).
Can you help - if you can I will be very greatful.
With time we live, with money we spend!
Joel Holdsworth
|
|
|
|
|
This is a wild guess, but... Are you sure the code of your class is being linked? Maybe the .cpp has been moved to a static library and the linker is stripping away the object code of the class because it is not directly referenced in the program.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Thanks for your kind suggestion, but, the code is accessed directly, and won't run into problems like this... but thankyou for trying
With time we live, with money we spend!
Joel Holdsworth
|
|
|
|
|
Another wild guess Have you been playing around with the schema number in the IMPLEMENT_SERIAL macro? There's an MSDN article that says something about a bug relating to using a schema number 0.
Maybe you can try to switch to another schema number and see what happens.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Is their a good way to check if a file exists?
I have a application that creates a text file called source.txt and once an event takes place I remove it.. the problem is if something happens and for some reason the file doesn't get created it pops up an error stating that the file doesn't exist.. I was wondering what the best way would be to do a "if exists" delete it "if not" pop up a msg stating that something went wrong..
Thanks,
Rob
|
|
|
|
|
Use DeleteFile() ; it the file does not exist, the function returns FALSE and GetLastError() yields ERROR_FILE_NOT_FOUND .
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Check also ERROR_PATH_NOT_FOUND and ERROR_ACCESS_DENIED
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Is this a good way of implementing what you have suggested?
DeleteFile("Source.txt");
DeleteFile("Time.txt");
DWORD dw = GetLastError();
if(GetLastError() != FALSE)
{
MessageBox("File Not Found!","Error", MB_OK);
}
It seems to work ok.
Thanks
Rob
|
|
|
|
|
Is this a good way of implementing what you have suggested?
No, it is not. DeleteFile() returns either TRUE or FALSE , and only in the latter case can you use GetLastError() to know the detailed cause of the failure:
BOOL bResult=DeleteFile("Source.txt");
if(!bResult){
DWORD dw=GetLastError();
if(dw==ERROR_FILE_NOT_FOUND){
MessageBox("File Not Found!","Error", MB_OK);
}
else{
}
}
This way of signaling errors (i.e., returning a BOOL and storing in case of failure an error code to be retrieved with GetLastError() ) is typical of many Win32 functions, so you might find it useful to get acquantied with it.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Thank you very much! I'm pretty new to programing and this kind of information helps alot!!!
Thanks again for you time,
Rob
|
|
|
|
|
http://www.codeproject.com/useritems/cwin32error.asp
that's an article bout how you can handle GetLastError Message.. i think it is a really interesting discussion in the discussion below the article.. maybe your interested..
happy learning
bernhard
stolen sig #15:
"The content of this post is not necessarily the opinion of my yadda yadda yadda."
|
|
|
|
|
Thanks!!
I will take a look at the article.. I'm very interested in learning anything new.
Thanks again,
Rob
|
|
|
|
|
I have a subroutine in a Visual C++ program using Microsoft's MCI that
records to a file named dummy.wav that already exists on C drive. If the
program is also on C drive all works well. However, if I put the program
on D drive, but still leave dummy.wav on C drive, the subroutine opens
c:\dummy.wav but will not save to it the first time the subroutine is
called. Instead it writes a temporary file of the type ~$mc331C.tmp to the
root of C. On calling the subroutine a second time, it works properly. MCI
does not report any errors when the subroutine is run. Can anyone explain
why it doesn't work the on the first call?
char strcmd[100];
wsprintf(strcmd,"open %s %s","c:\\dummy.wav","wait");
if (mciSendString(strcmd,NULL,NULL,NULL))
AfxMessageBox("error opening dummy.wav",MB_OK,NULL);
wsprintf(strcmd,"record %s %s %s","c:\\dummy.wav","from 0 overwrite to 1000","wait");
if (mciSendString(strcmd,NULL,NULL,NULL))
AfxMessageBox("error recording dummy.wav",MB_OK,NULL);
wsprintf(strcmd,"save %s %s","c:\\dummy.wav","wait");
if(mciSendString(strcmd,NULL,NULL,NULL))
AfxMessageBox("error saving dummy.wav",MB_OK,NULL);
wsprintf(strcmd,"close %s %s","c:\\dummy.wav", "wait");
if (mciSendString(strcmd,NULL,NULL,NULL))
AfxMessageBox("error closing dummy.wav",MB_OK,NULL);
Note: if I execute the program with a .pif style shortcut, the behaviour is
as described above, except that when I quit the program and then restart it,
it works properly on the first call to the subroutine, unless I reboot the
computer. However, if I execute the program with a standard Win98 or Me
shortcut, the call to the subroutine fails on the first try and succeeds on
subsequent calls every time the program is executed from the shortcut icon.
|
|
|
|
|
I would like to be able to programmatically query a process' opened files (don't confuse with EnumProcessModules). I know it is possible (TaskInfo2000 does it). Can I do that using a Win32 or Shell function/object? I wasn't able to figure out yet.
Tx
|
|
|
|
|
Hi,
I Use Visual C++ 6.0 and an access Database.
I want to execute a SQL statement with CDaoRecordset. This error message occurs : "Too few parameters. Expected 1" when i use Open method.
My SQL statement is longer than 256 characters ( about 1100 ). The problem is here it seems.
If i run This query directly in Microsoft Access, it work.
Is there any method to execute un SQL Statement like this in DAO ( CDaoDatabase ) ???
Thanks in advance
Regards,
|
|
|
|