|
use _ttoi which is the TCHAR version
int n = _ttoi((LPCTSTR) str);
|
|
|
|
|
And what kind of function is to convert a string (CString) to a float?
|
|
|
|
|
Like any of the A functions atoi() never ever supports unicode (same goes for itoa()). Use either _wtoi or _ttoi.
Anonymous wrote:
How can I write the function (convert a CString to a integer and float) so that it works with and without UNICODE?
int whatever = _ttoi((LPCTSTR)str);
or, if you want explicit support
if(bUnicode)
whatever = _wtoi((LPCWSTR)str);
else
whatever = atoi((LPCSTR)str);
...if you're under 8 or younger. Chris Maunder, the Lounge
|
|
|
|
|
Hello,
I have a dumb question.. I have an app that runs perfectly fine in Debug mode.. no problems what so ever, but when I try to run it in release build it errors when I first fire it up with a "The instruction at "0x0040cf93" referenced memory at "0x0010ab000". The memory could not be "read"." How does someone go about finding out why this is happening only in the release build?? Kinda weird.
Thanks!
Rob
|
|
|
|
|
Never mind I had a build setting out of wack..
Thanks anyway
|
|
|
|
|
Hello
Anyone knows how we can change the current XP theme via code?
I am looking for a reverse version of GetCurrentThemeName.
Or is it enough to modify the registry (assuming thats where the data is
stored) and then send a WM_SETTINGCHANGE to all top level windows?
Regards and thanks,
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Review by Shog9
Click here for review[NW]
|
|
|
|
|
|
Hi how are you,
Do you know how I could plot some histograms in C++.
This whole thing should look something like that:
"There are 4 values for each #
Histogram starts at 10.000 with a step size of 5.000.
10.000 : ########
15.000 : #############
20.000 : #######
25.000 : #########################
30.000 : ###############
There are 15 inputs not in the range 10 to 35.
Can you tell me how I could proceed to plot a histogram in C++ like this. It should involve
• A function to read the input values and keep the count in an array.
• A function to obtain the maximum value in a given array.
• A function to calculate an integer division, but with rounding up.
• A function to plot the histogram.
• The main function to drive the whole program.
If you have any suggestions or some good links to any website that might concentrate on histograms, would be of great
help for me.
Thanks
|
|
|
|
|
Go to http://root.cern.ch
and download the Root package. This includes an C++ Interpreter and many visualization
classes in C++. Including 1,2,3-D Histograms, Fitting algorithms 3D-Functions and much more.
e.g The C++ Script: http://root.cern.ch/root/html/examples/hsum.C.html
produces this Histogram
http://root.cern.ch/root/html/examples/gif/hsum.gif
Hope this helps.
Yours,
Alois Kraus
|
|
|
|
|
This sounds too much like a school assigment, please start writing code, and we'll be really happy to help you with specific questions!
I may sound harsh, but that's the way it is. but I will give you a hint, not a programming one, but a generic one :
When facing a problem like this, first, start by figuring out how you'd do this manually, write things down using real words and you find that the answer is really simple and that "translating" it to any programming language is easy!.
Max.
|
|
|
|
|
Go see your professor or your teaching assistant.
|
|
|
|
|
Hi there,
Would anyone happen to know how I could go about sending an email + attachment using the user's default mail program, such as Outlook Express? Well, really all I need is to pop up the Outlook Express mail composition with stuff like body text, subject, and email attachment already filled in. (The email attachment is the hard part, as the other stuff can just be put into a mailto tag.)
Any ideas?
Much thanks!
swine
Check out Aephid Photokeeper, the powerful digital
photo album solution at www.aephid.com.
|
|
|
|
|
|
Thanks! Actually I just stumbled upon this a couple of minutes ago and was able to send out an email using MAPI. The problem is that the user still has no access to their address book from which they can pick email names.
What I would really need to do is pop up the email composition window of the default email program. Is this possible through mapi?
Thanks!
swine
Check out Aephid Photokeeper, the powerful digital
photo album solution at www.aephid.com.
|
|
|
|
|
Ooops nevermind, I found the MAPI_DIALOG flag .
cheers!
Check out Aephid Photokeeper, the powerful digital
photo album solution at www.aephid.com.
|
|
|
|
|
MAPI works nicely.
Shog9
------
If you really what to get shitfacde tell a crowded bar that is is yourt borthday and hife your wallet. you ka will many more friends.
- David Wulff, Brithday selebrations, 9/19/02
|
|
|
|
|
Thanks! Actually I just stumbled upon this a couple of minutes ago and was able to send out an email using MAPI. The problem is that the user still has no access to their address book from which they can pick email names.
What I would really need to do is pop up the email composition window of the default email program. Is this possible through mapi?
Thanks!
swine
Check out Aephid Photokeeper, the powerful digital
photo album solution at www.aephid.com.
|
|
|
|
|
Ooops nevermind, I found the MAPI_DIALOG flag .
cheers!
Check out Aephid Photokeeper, the powerful digital
photo album solution at www.aephid.com.
|
|
|
|
|
if i hava a class
class a
{
int a;
CString str;
};
i want to write its object into a file and send that file through a network to different computer and i want to recive that object again if i have the same class there.
may i read the same object on network from a file?
any body can explain my idea into code like
how to write object into file ?
how to read object on the network (having same class there) from file ?
r00d0034@yahoo.com
|
|
|
|
|
See Serialize (u must thus derive ur class from CObject)
archives and using archives with sockets!
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Hi.
I am working on a simple client-based winsock Windows program. The program works well under the current software design. However, I discovered a huge resource problem.
The program support multiple simultaneous connections. I use the WSAAsyncSelect() I/O model to handle I/O. Everything works well. I implemented two worker threads. One thread sends data. The second thread receives data. WSAAsyncSelect() sends messages via Windows queue and update the program on FD_WRITE, FD_READ, etc. Again, the program works as planned.
I discover a huge resource problem. The program takes up all CPU resource as it makes more and more socket connnections. In other works, the program stalls if the user attemps to makes ten or more connections. CPU usage is 100%.
I re-read Network Programming for Microsoft Windows, Second Edition by Anthony Jones and Jim Ohmund. If I am not mistaken, you do not need workers thread for winsock if you use a non-blocking I/O such as WSAAsyncSelect().
I would like to know if there is a flaw in the program design. My thought right now is that this design will not work because of the worker threads. There is no way Windows can handle too many worker threads. However, let say I implemented WSASend() and WSARecv() solutions directly in the primary thread (main applications), I believe that will lock up Windows or at least the program. For example, if I implement a while loop that calls WSARecv() until it returns 0, that will lock up the program. Is that right?
Thanks,
Kuphryn
|
|
|
|
|
is there a while ( true ) loop somewhere??
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Yes, the problem definitely resulted from a while-loop. I am in the process of implementing a different approach to the algorithm.
I am debug a weird problem. For some reason, I cannot close an event handle. For example,
-----
HANDLE mEvent = ::CreateEvent(NULL, TRUE, FALSE, NULL);
...
// This code crashes the program.
// Visual C++ debug says the error has something to do with an invalid
// handle.
::CloseHandle(mEvent);
-----
Kuphryn
|
|
|
|
|
Did you check that your handle was valid before trying to close it?
Signature space for rent. Apply by email to....
|
|
|
|
|
is the event being created??
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|