|
GC104 wrote: CharCount2 = 0x2345; // ###
CharCountThree = 0x5678; //###
CharCount2 = sizeof(TxString);
CharCountThree = sizeof(pOutputString);
Maybe the compiler optimizes that to:
CharCount2 = sizeof(TxString);
CharCountThree = sizeof(pOutputString);</blockquote>
BTW please use the code block to submit code snippets.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Could it be that you are debugging a release build?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
Hi all,
Thanks for responses. It looks like CPallini nailed it - the compiler doing its job! I have since added more data members to capture the results of the various functions I used on the original code. However this time, the debugger runs through eacdh line and loads each variable with the value I was expected
many thanks
Geoff
|
|
|
|
|
Hi every body!
Is there any way/tool to find out which module creates a specific file? E.g one can see a process named Process.exe and this process has loaded a few DLL. What I want to know is which of theses DLLs creates a given file (e.g. C:\file.ext)
Thank you masters!
|
|
|
|
|
unless you have the source code to the dll, I doubt it after the file has been created and closed. If the file is open, there are tools around that are the windows equivalent of the 'lsof' command - systinternals (now part of Microsoft) has a tool to display (iirc) open files vs the processes that have them open
'g'
[edit] I was wondering if the file properties (custom) would be useful, but surely that depends on a well behaved application filling them out in the first place[/edit]
|
|
|
|
|
Thank you for your answer. I meant something like that I can examine a specific DIRECTORY or FOLDER so that I can catch every process that attamps to create or modifiy a file.
Thank you masters!
|
|
|
|
|
|
Further to R.selvam's answer - FileMon's been deprectaed - MS recommend you use ProcMon[^] now. That allows you to capture more than just file accesses, for example registry accesses as well.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
You don't need any tool, just use NAPI
|
|
|
|
|
If an API is not a tool, then please tell us what it is?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
I am learning to use VS2005 to create a VC++ MFC project to read from the serial port using the 'ReadFile' function. in particular I am having problems getting the code to compile 'ReadFile' parameter 4:
h-file
...
DWORD ActualBytesRead
DWORD * pActualBytesRead
...
cpp-file
attempt 1:
pActualBytesRead = &ActualBytesRead
ReadFileStatus = ReadFile(SerialPortHandle, &ReceiverBuffer, NumberOfBytes2Read, pActualBytesRead, NULL)
-compiles, but parameter 4 ends up with 0xbaadF00d at the time of the 'ReadFile' call?
attempt 2:
ReadFileStatus = ReadFile(SerialPortHandle, &ReceiverBuffer, NumberOfBytes2Read, &ActualBytesRead, NULL)
-compiles (passing by reference?)
attempt 3:
pActualBytesRead = &ActualBytesRead
ReadFileStatus = ReadFile(SerialPortHandle, &ReceiverBuffer, NumberOfBytes2Read, *pActualBytesRead, NULL)
-won't compile?
OK, so I have a version of code that compiles but I don't really understand why attempt 1 & 3 fail?
modified on Tuesday, September 8, 2009 11:06 AM
|
|
|
|
|
1 and 3 fails because you're passing a DWORD** instead of DWORD* .
The following should compile.
DWORD ActualBytesRead = 0;
BYTES ReceiverBuffer[1024];
DWORD NumberOfBytes2Read = 1024;
ReadFileStatus = ReadFile(SerialPortHandle, ReceiverBuffer, NumberOfBytes2Read, &ActualBytesRead, NULL);
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
«_Superman_» wrote: 1 and 3 fails because you're passing a DWORD** instead of DWORD*.
Actually, in the first case he is passing a DWORD* (so this should compile) and in the third case he is passing a DWORD.
|
|
|
|
|
GC104 wrote: ReadFileStatus = ReadFile(SerialPortHandle, &ReceiverBuffer, NumberOfBytes2Read, pActualBytesRead, NULL)
-won't compile, even though I am passing a pointer to a 'DWORD'?
This compiles for me.
GC104 wrote: ReadFileStatus = ReadFile(SerialPortHandle, &ReceiverBuffer, NumberOfBytes2Read, *pActualBytesRead, NULL)
-won't compile?
Because argument 4 is the contents, or value, of pActualBytesRead .
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Since posting the original message, I would expect attempt 1 to compile. Is this likely to be a quirk in the VS2005 VC++ compiler? Many thanks for thoughts.
Geoff
|
|
|
|
|
Without seeing the actual error message, I've no idea.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Sorry, I made a typo whilst trying 'attempt 1'. Yolu're right it does compile, the problem is that pActualBytesRead gets loaded with 0xbaadf00d prior to the 'ReadFile' call.
Thanks for help
|
|
|
|
|
Hi,
I try to get the current position of pointer in the stream (IStream interface) with the method Seek (IStream::Seek Method) but i can't succeed to do this.
So can someone help me how to do this OR if there is an other method to get the current position from this stream?
thank you
|
|
|
|
|
Ummm - try this:
ULARGE_INTEGER currPos;
LARGE_INTEGER offset;
offset.QuadPart = 0;
istreamInterfacePointer->Seek(offset, STREAM_SEEK_CUR, &currPos);
Zero offset from the current position will be the current position...
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Thank you , it work
can you please help me again and tell me how can use Seek to get the size of the current stream ?
thanks
|
|
|
|
|
ULARGE_INTEGER currPos;
LARGE_INTEGER offset;
offset.QuadPart = 0;
istreamInterfacePointer->Seek(offset, STREAM_SEEK_END, &currPos);
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi to All,
I need help in understanding the difference between copy constructor and assignment operator, and when do we use them exactly,...and with contrast of shallow and deep copy too.
I tried to understand from internet, but still I didn't get a clear picture of it.
Could someone please put some light for the same.
Thanks in advance.
-----------------------------
I am a beginner
|
|
|
|
|
MyClass a;
MyClass b(a);
MyClass c = b;
MyClass d;
d = c;
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
thanks,
But when do we overload each of them?...I mean when do we use copy constructor and when assignment operator
-----------------------------
I am a beginner
|
|
|
|
|
hrishiS wrote: I mean when do we use copy constructor and when assignment operator
In the vast majority of cases, you have to do both of them. I never encountered a case in which the copy constructor would do something different than the assignment operator.
In general, you need to provide them if you have to provide a smarter "copy" mechanism (for instance your class contains a pointer which should be recreated instead of simply assigning the same address).
|
|
|
|