|
AFAIK, you wont be able to do this on a single CPU computer.
me think that in the best case scenario, you will have the same time, but in some other cases, it will take more time because of context switching between threads.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
After each file's contents have been read into a separate (heap) buffer, call AfxBeginThread() , passing it the address of the buffer. As each thread completes its processing, it will free the heap memory.
Since some of the earlier threads will have completed by the time the later ones are created, you probably won't have 60 threads in existance at one time.
Make sense?
Assuming you get this working, it would be to your benefit to benchmark it against your initial design using sequential processing. I would be surprised if the additional overhead of extra threads was of any real benefit.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
how i can access to memory loaded
am
|
|
|
|
|
Be more specific.
INTP
Every thing is relative...
|
|
|
|
|
|
If you want to know what has been loaded into memory, then it depends on the Operating System. If it is NT-based, Windows will hardly let you read anything other than your own variables and program code. It can be done but difficult. You can check for the readable and/or writable memory using some API functions like:
BOOL IsBadReadPtr(const VOID* lp, UINT_PTR ucb);<br />
BOOL IsBadWritePtr(LPVOID lp, UINT_PTR ucb);
If you really want to get to the core, then use MS-DOS. It will let you do anything you want.
Like:
unsigned far char* p = 0;<br />
p++;<br />
...<br />
...
[Edit]Correction:
I wrote unsigned far char* as unsigned long char* Heh.[/Edit]
this is this.
-- modified at 6:37 Wednesday 1st March, 2006
|
|
|
|
|
Hi!
I want know around Anti-Debugger Codes.
please help me!
Zo.Naderi-Iran
|
|
|
|
|
Before someone can answer this question, we need to know what "Anti-Debugger Codes" mesans!
INTP
Every thing is relative...
|
|
|
|
|
|
hello all
how to place bitmaps over the buttons using the property Setbitmap and getbitmap in vc++.
Thanks in advance
cheers
ramya
|
|
|
|
|
Declare a CBitmapButton control variable for the button and call the LoadBitmaps() method.
Set the OWNERDRAW property for the button.
Vini
|
|
|
|
|
|
hon can i get motherbord id and vedio card id and when i can find them
am
|
|
|
|
|
ss2006 wrote: hon can i get motherbord id and vedio card id and when i can find them
try WMI[^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Hi All,
I have some queries to you people. It would be of great help if someone gives me answers for them.
1. what is the difference betn, structures in C++ and class in C++
2. what is the difference betn. structures in C and structures in C++
3. what is basically a mutable member
4. how do i call a C function from a C++ program. Do I need to use any keywordexplicitly?
Thanks In Advance
|
|
|
|
|
Subramaniam s.V. wrote: what is the difference betn, structures in C++ and class in C++
a structure in C++ IS a class, which default members are set to public instead of private .
Subramaniam s.V. wrote: what is the difference betn. structures in C and structures in C++
a structure in C is only a declaration of several types disposed contiguously, encapsulated within a name. in C++, a structure is a class, which mean that it can have all the classes enhancements, like member functions, constructors/Destructors, etc...
Subramaniam s.V. wrote: what is basically a mutable member
according to the MSDN[^], a mutable member can be modified by any function that can access it, even if the function is declared as const (a function declared as const is normally not allowed to change the class members).
Subramaniam s.V. wrote: how do i call a C function from a C++ program
you mean, withing the same project ?
just as you would have done in a C program...
TOXCCT >>> GEII power [toxcct][VisualCalc 2.24][3.0 soon...]
|
|
|
|
|
First this is a school question.
1) The difference is that a C++ class defaults to private and a structure defaults to public.
2) In C there are no member functions; a structure is just a set of data. That is it represents the equivalent of a record.
3) You are learning! A mutable member is a variable that can be changed at any time. You see there are member variables that may need to be changed, while giving the impression that nothing has changed, from the user point of view.
4) All I can say is YES, depending on the compiler and what you specify in your code.
INTP
Every thing is relative...
|
|
|
|
|
Is there an easy way to check available memory before / after using *p = new int[ ] ? I tried CMemoryState, without success.
|
|
|
|
|
I am not sure if there is a single function call that can give an answer to your question. This would have been a simple question before the advent of virtual memory, but that is no longer the case. If you want to know the physical memory available then you may have to experitment, but that limits you to the machine you are on. Write your programm in such a way that it can compensate for the lack of phisycal memory, or can inform the user if it can not.
I am just saying that we no longer know the amount of memery available and you have to make sure that if it is not, your progam catches that problem before it crashes some bodies machine.
INTP
Every thing is relative...
|
|
|
|
|
Thanks John, it´s clear that new returns 0 if allocation failed. I´m just looking for a way of checking available memory before and after such operations. Due to the dynamic memory model in windows it may be impossible to get exact required data. Purpose is not implemeting it in a commercial application but memory usage demonstration to students. In DOS times ( a century ago ) we had a similar function.
|
|
|
|
|
Have a look at the GlobalMemoryStatus() function.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
I doubt it, since freed memory does not automatically go right back to the pool of available memory. Windows' memory manager is a very complex beast.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
pls give the code for getting Ip address of the computer using VC++
|
|
|
|
|
There are lots of examples here on CP about this topic, but here is some quick code:
WSADATA data;<br />
WSAStartup(MAKEWORD(2,2),&data);<br />
char szHostname[256];<br />
if (gethostname(szHostname, sizeof(szHostname)))<br />
{<br />
WSAGetLastError());<br />
}<br />
HOSTENT* pHostEnt = gethostbyname(szHostname);<br />
if (pHostEnt == NULL)<br />
{<br />
WSAGetLastError());<br />
}<br />
if (pHostEnt->h_length != 4)<br />
{<br />
}<br />
int nAdapter = 0;<br />
in_addr address;<br />
CopyMemory(&address.S_un.S_addr, pHostEnt->h_addr_list[nAdapter], pHostEnt->h_length);<br />
dwIP = MAKEIPADDRESS(address.S_un.S_un_b.s_b4, address.S_un.S_un_b.s_b3, address.S_un.S_un_b.s_b2, address.S_un.S_un_b.s_b1);
Now the address is in dwIP as a DWORD also.
Also available through the:
address.S_un.S_un_b.s_b1<br />
address.S_un.S_un_b.s_b2<br />
address.S_un.S_un_b.s_b3<br />
address.S_un.S_un_b.s_b4
as individual unsigned bytes.
this is this.
|
|
|
|
|
go thru this one.
char szHostName[128];
if( gethostname(szHostName, 128) == 0 )
{
// Get host adresses
struct hostent * pHost;
int i;
pHost = gethostbyname(szHostName);
for( i = 0; pHost!= NULL && pHost->h_addr_list[i]!= NULL; i++ )
{
CString str;
int j;
for( j = 0; j < pHost->h_length; j++ )
{
CString addr;
if( j > 0 )
str += ".";
addr.Format("%u", (unsigned int)((unsigned
char*)pHost->h_addr_list[i])[j]);
str += addr;
}
// str now contains one local IP address - do whatever you want to do with it (probably add it to a list)
}
}
viveks
|
|
|
|