|
This site is CP
SideNote: TransmitFile is optimized for speed in XP and space on Windows2K Server
Cheers,Joao Vaz
And if your dream is to care for your family, to put food on the table, to provide them with an education and a good home, then maybe suffering through an endless, pointless, boring job will seem to have purpose. And you will realize how even a rock can change the world, simply by remaining obstinately stationary.-Shog9
Remember just because a good thing comes to an end, doesn't mean that the next one can't be better.-Chris Meech
|
|
|
|
|
hi,
i'd like to find out how we can make use of 1 cpu in a dual-cpu system to do some work with 1 thread and then the other cpu to do something else with another thread.
my problem is, very often we create 2 threads but have no control which cpu handles them. i'd like to know how to control which cpu handles which thread.
appreciate any advice...
thanks very much.
|
|
|
|
|
Check SetProcessAffinityMask and SetThreadAffinityMask , but a BIG but , IMHO only users with advanced MT knowledge should do this, and even so, 99% of time isn't needed to do this, The OS Scheduling Polily should decide for you, since have better knowledge what to do. Also most MT experts are against this type of Processor thread-bounding and normally they don't bring any kind of advantage to your application. Post your question on comp.programming.threads[^] and be prepared for the worst
And btw , why on earth do you want to do this ???
Documentation on mdsn site about the 2 apis listed above
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/multiple_processors.asp[^]
Cheers,Joao Vaz
And if your dream is to care for your family, to put food on the table, to provide them with an education and a good home, then maybe suffering through an endless, pointless, boring job will seem to have purpose. And you will realize how even a rock can change the world, simply by remaining obstinately stationary.-Shog9
Remember just because a good thing comes to an end, doesn't mean that the next one can't be better.-Chris Meech
|
|
|
|
|
Okay, this doesn't have to do with resizing (shrinking/expanding) array using CArray or anything. This is in good old C. Anybody know how I can possibly do this? I need to read strings from a file into an array, but I need to be able to resize it if it goes over 'x' elements or if I don't fill up 'x' elements, I can free the remaining unused elements. For example,
<br />
int array_size = 100;<br />
char mystupidarray[array_size];<br />
<br />
<br />
<br />
...<br />
if( element_counter > array_size)<br />
{<br />
<br />
<br />
}<br />
else if( element_counter < array_size )<br />
{<br />
<br />
<br />
}<br />
...<br />
<br />
So do you catch my drift?? Sorry, I kind of think better sometimes if I can show a basic idea of what I'm trying to get at in code. I've searched some books, but haven't found what I'm looking for. So I, being part of CP.com, though I could post it here. Any hints, suggestions, flames (erk!) will be greatly appreciated.
Kevin P., stabbing the harlet to pay for her sins, leaving the virgin.
|
|
|
|
|
The only idea I have is to use realloc() , which probably does malloc() the memory needed, and then copies from the old buffer (on which is then called free() )
For more information, just enter malloc into the MS knowledge base.
"My opinions may have changed, but not the fact that I am right."
Found in the sig of Herbert Kaminski
|
|
|
|
|
Firstly, mystupidarray would have to be a pointer, not an array allocated on the stack:
int array_size = 100;
char* mystupidarray = malloc(array_size) ; // I forget the malloc signature, but 100 bytes allocated
...
// you have to allocate a new array and copy the old one across into it
if (element_count > array_size)
{
new_size = array_size + 100 ;
pNew = malloc(new_size);
memcpy(pNew, mystupidarray, array_size);
free(mystupidarray);
mystupidarray = pNew;
array_size = new_size;
}
its the same for making it smaller, but make sure the copy the actual number of bytes in the new array, not the size of the original.
Roger Allen
Sonork 100.10016
In case you're worried about what's going to become of the younger generation, it's going to grow up and start worrying about the younger generation. - Roger Allen, but not me!
|
|
|
|
|
Kevin Power wrote:
I need to read strings from a file into an array, but I need to be able to resize it if it goes over 'x' elements or if I don't fill up 'x' elements, I can free the remaining unused elements.
My advice is using a std::vector and do not hazzle with handcoded stuff here. STL is highly effective and will fullfill your digital needs here. std::vector will automatic realocate if needed, and with the swap trick (see 'Effective STL' from Scott Meyers) you can free unneeded capacity.
Hope it helps.
|
|
|
|
|
*** Note: this is in response to the last three posts
This is going into an windrop (eggdrop on windows), which is strictly C. If I could, I would use C++ to get around the extra work. Thank you all, though. I do appreciate you input. I didn't think of allocating the file size instead of 100 or so chars. I will be putting this to work immediately.
Kevin P.
|
|
|
|
|
Its very stoopid to resize for 100 char.
If your reading from a file it would be best practice to get the filesize anf than allocate the memory.
Do your homeworks.
Try this @ home. (B&B)
|
|
|
|
|
Or just use CStringArray()
|
|
|
|
|
I have a function called mycreatewindow function in dll
if i call this function from my exe i want to create one window and display the window.Is it possible to do in win32 dll.if it is how to do it.
Pl reply.
|
|
|
|
|
I need to get the GetDockedControlBar option of CDockBar, but it says that is a protected member, how can i access to this?
|
|
|
|
|
You need CDockBar to be a friend class of yours, or your class needs to be derived from CDockBar. Obviously only the second of those options is possible for you.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
I've derived a class from CDockBar, it's called CDockBarEx but i still having the same problem, why is this?
|
|
|
|
|
CosmoS2k wrote:
why is this?
The member is probably private, not protected. a.k.a. you're screwed.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
new error "syntax error : CDockBarEx", now this error appear, i'm confused???
|
|
|
|
|
The code generating this error is clearly not able to see the class. Not that it matters, as I said, if it's private then it's not going to be exposing this variable to you anyhow.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
but i can't believe that, the GetDockedControlBar is supposed to be protected member and not private, so how can i acces this?
|
|
|
|
|
If your derived class cannot see it, then it is private, not protected, or it is exposed through some other inheritance mechanism that you've not addressed. look at the source code, it's on your hard drive.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
hello.
i have made a access table inwhich field is Date of data type "Date/Time" and input mask "99/99/00;0"
i want to access that record through ADO.
A generic class with Variable
DATE m_dtBirthdate;
ULONG lBirthdateStatus;
BEGIN_ADO_BINDING(CCustomRs)
ADO_FIXED_LENGTH_ENTRY(3,adDate,m_dtBirthdate,lBirthdateStatus,TRUE)
END_ADO_BINDING()
in VIEW class
if (((DATE)m_oledtBirthdate) != pRs->m_dtBirthdate)
pRs->m_dtBirthdate = (DATE)m_oledtBirthdate;
here m_oledtBirthdate is form variable for edit box.
Problem is::
when i add new record then bydefault/changed value (1/1/1970 5:00:00 AM)can not enter into the table field.
OnAdd function::when i need to add new record. i have declare
COleDateTime dtBlank;
m_rsRecSet.m_dtBirthdate = (DATE)dtBlank;
Can any help me.
Advance Thanks.
dsad
|
|
|
|
|
I am a Sr.Software Engg, working on Win32 Functions in MAPI developement in VC++6.0.I want to know is there any way of sending a mail in HTML format using MAPI. I want to send the mail in using BOLD,UNDERLINED,FONTSIZE etc etc using HTML tags. Like the features incorporated in Yahoo. I am usingMAPI control in my VC++ application for sending mails. For ex the user enters the body of the mail as Hello World <\b>. Then when i send the mail, the person who receives the mail shld get the Hello World in bold format. Hope my problem is clear for you. So i want to incorporate this HTML tag feature in my mail application using Win32 Functions in MAPI and the programming environment is VC++ 6.0.
Plan your work n work your plan
|
|
|
|
|
Can somebody please initiate me into the basics of a firewall..i need to write a firewall in vc++ but i dont know how to intercept http..
thank you.
Satya Kiran.
|
|
|
|
|
I don't see how anyone can answer that for you without writing you a firewall. Why do you need to write one ?
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
I'm sure if you look round SourceForge and the other open-source sites you'll find the code for one.
Michael
Life’s not a song.
Life isn’t bliss.
Life is just this.
It’s living. -- Buffy the Vampire Slayer: Once more, with feeling
|
|
|
|
|
SatyaKiran wrote:
intercept http
If you need to "intercept http", it will be a lot easier for you if you write a proxy, not a firewall. There are samples here in Codeproject of proxies that do this.
My latest article:
SQL Server DO's and DONT's[^]
|
|
|
|
|