|
ok. What about data reading. Using VC++ function sometime API hangs which read data. Will assembly code success in this. And to read data asynchronously is not reliable because it depends on disk to disk.
|
|
|
|
|
There's no reason why a C++ API should "hang" as such while reading a file. It may be due to disk latency, which cannot be cured if you change the programming language that was used to read data.
It was ever thus, the Neophiles will always rush out and get 'The Latest Thing' at a high price and with all the inherent faults - Dalek Dave.
|
|
|
|
|
|
Don't bother trying to use assembly language for this type of thing. Under modern operating systems you're always going to have to use some OS service to access the disk whatever language you're programming in. Even if you write a device driver to do the access there's no point in using an assembly language as writing it in C will be easier and probably as fast and efficient. And even if you write a device driver you're still relying on the OS to call the driver for you so you're still at the mercy of the OS.
Cheers,
Ash
|
|
|
|
|
Thanks
I experienced that asynchronous disk io is not reliable. Am i correct?
If not then please give some idea about the way to use it
|
|
|
|
|
What do you mean with "reliable" ?!?
2 bugs found.
> recompile ...
65534 bugs found.
|
|
|
|
|
it is known to occasionally return bits that are neither one nor zero.
|
|
|
|
|
Hi there,
I need to use a memory checker "like" Intel Memory Inspector.
Of course I do'nt have 800 USD to buy such tool so I wonder if there are alternatives ?
Push Framework - now released !
http://www.pushframework.com
|
|
|
|
|
|
Hi all,
I'm stuck with this.
I want to find the memory usage of my application. So I can work on with GetProcessMemoryInfo, and I need to find the relevant process ID in-advance to workaround. It's possible too.
But if my application runs multiple instances I cannot do that. Because all the process has the same name I cannot pick what the ID is.
Any suggestions really appreciate.
I appreciate your help all the time...
CodingLover
|
|
|
|
|
You could use the GetCurrentProcess[^] function and pass it to GetProcessMemoryInfo[^].
HANDLE hProc = GetCurrentProcess();
PROCESS_MEMORY_COUNTERS_EX info;
info.cb = sizeof(PROCESS_MEMORY_COUNTERS_EX);
GetProcessMemoryInfo(hProc, (PROCESS_MEMORY_COUNTERS*)&info, info.cb);
modified 13-Sep-18 21:01pm.
|
|
|
|
|
Thanks for the replay.
Actually I comes with an error, undeclared identifier on the following.
Thaddeus Jones wrote: PROCESS_MEMORY_COUNTERS_EX info;
I've included psapi.h header too.
I appreciate your help all the time...
CodingLover
|
|
|
|
|
You can try PROCESS_MEMORY_COUNTERS instead, maybe PROCESS_MEMORY_COUNTERS_EX was introduced later than your compiler (it requires WinXP SP2 or above).
modified 13-Sep-18 21:01pm.
|
|
|
|
|
That's why I'm wired. I'm working on WinXP SP3.
Anyway I work on with PROCESS_MEMORY_COUNTERS, and works fine. But when I'm invoking GetProcessMemoryInfo(...) it gives an unusual error at build.
error LNK2019: unresolved external symbol _GetProcessMemoryInfo@12 referenced in function "public: void __thiscall CMyExceptionLogger::LogMemoryUsage(enum LOGLEVEL)" (?LogMemoryUsage@CMyExceptionLogger@@QAEXW4LOGLEVEL@@@Z)
You have any idea about this?
I appreciate your help all the time...
CodingLover
|
|
|
|
|
Did you link psapi.lib to your project?
modified 13-Sep-18 21:01pm.
|
|
|
|
|
Oh no. I don't. Could you please guide me how to do that?
I appreciate your help all the time...
CodingLover
|
|
|
|
|
That varies per compiler, you'd have to look that up in the manual.
Typically there's a menu item named Project with subitem Settings or Configuration or something.
modified on Monday, December 6, 2010 8:25 AM
modified 13-Sep-18 21:01pm.
|
|
|
|
|
As replied, you can use GetCurrentProcess to get a handle to the current process.
But this is a pseudo-handle and its value is always -1 .
This handle is not valid outside of the current process.
If you want to pass the handle to another process, you can call DuplicateHandle on this pseudo-handle to get a real one.
|
|
|
|
|
Hi
How to convert a CString value to HEX?
eg:
CString strHex = "0008103e";
to
HEX value = 0x0008103e
please help
Thanks
|
|
|
|
|
An hex value doesn't exist, what you want probably is to convert a string representing an integer in hexadecimal notation to an integer. For this you can use strtol[^] function.
|
|
|
|
|
Benjamin Bruno wrote: How to convert a CString value to HEX?
eg:
CString strHex = "0008103e";
to
HEX value = 0x0008103e
What Cedric said.
ULONG nVal;
CString str = _T("0x4335");
nVal = _tcstol(str, NULL, 0);
It was ever thus, the Neophiles will always rush out and get 'The Latest Thing' at a high price and with all the inherent faults - Dalek Dave.
|
|
|
|
|
You got excellent C answers. In C++ use the facilities of the Standard C++ Library:
#include <sstream>
int GetIntFromHexString(const char* HexString)
{
int val;
std::istringstream(HexString) >> std::hex >> val;
return val;
}
cheers,
AR
When the wise (person) points at the moon the fool looks at the finger (Chinese proverb)
|
|
|
|
|
It can be read words in .pdf document file ? Should be use an special .pdf library , or MFC can do that ?
|
|
|
|
|
You should either use a library or parse yourself the PDF format (specifications are available).
I believe there are articles, here at CodeProject, covering both techniques.
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]
|
|
|
|
|
After all , I need a pdf library to read words in .pdf file ... I was thinking that MFC knows something tricky ...
|
|
|
|