|
Thank you,but if i have a string,i.e : "jry1924",how to check whether it is a number or not?
I tried using function atof but if your string is not a number,it returns 0.
Help me pls!
|
|
|
|
|
The only verification that you can do is check if there's a , or . (depending on how you represent floating points numbers ) in the string, between 2 numbers, if it's the case, you can deduce it's a float.
for exemaple
CString sNumber ( "123.123" );
could/would be a float.
but
CString sNumber ( "123123" );
can either be an integer or a float.
or you could use atof and related functions, or maybe sprintf , check the documentation of those functions.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
however, you also have to test, even if there is a , or a . , if the string is a valid number.
consider the string "3..2.4" ... not really a number isn't it ?
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
toxcct is rit or u can check it this way also
std::string str = "123.45";
int pos = str.find(".");
if(pos == -1)
cout<<"It's int"<
|
|
|
|
|
Hi,
Recently, one of our customers reported a strange problem with our software. It happened so that due to some problem in the power to the computer, the power supply (SMPS) of the PC got damaged. After rectifying the fault, he started using our software, and reported that our application crashes at various locations where it worked fine before. When I check the exception being raised, it says float point division by zero exception. Now all of sudden at various places in my code where I use division (for e.g., progress bars) the application fails there.
Could anyone suggest what could have gone wrong and how to fix it?
Thanks,
Krishnan
|
|
|
|
|
Definately sounds like a hardware problem,
have a quick read of this[^],
|
|
|
|
|
How can I constrain the mouse movement to a rectangle? I remember there is a windows function for that but I do not know it.
Thank you !
modified 9-Mar-17 17:22pm.
|
|
|
|
|
|
With OLE DB CONSUMER, how can i execute a parameterized or not stored procedures and queries ? Using Visual C++
I am learning my self
|
|
|
|
|
In a project I am working on I am using a legacy DLL. I have created an MFC Dll project that is using MFC as a shared DLL and is also using the legacy DLL. The project compiles fine. Then I created a Console application to use the DLL and an assertion "Debug Assertion Failed" in the file: "afxwin1.inl" was thrown. When running the same Dll from an MFC Windows application the assertion doesn't appear. How can I overcome this problem?
|
|
|
|
|
ikasovitch wrote:
...and an assertion "Debug Assertion Failed" in the file: "afxwin1.inl" was thrown.
What line fired the assertion?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
The line 19 fired the Assertion
|
|
|
|
|
Which indicates that AfxGetInstanceHandle() is being (indirectly) called but afxCurrentInstanceHandle is NULL . Are you using AFX_MODULE_STATE ?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I don't know what is AFX_MODULE_STATE.
1. Can you explain what is it?
2. How can I find out if I am using it?
|
|
|
|
|
Anonymous wrote:
I don't know what is AFX_MODULE_STATE.
1. Can you explain what is it?
See here and here for starters.
Anonymous wrote:
2. How can I find out if I am using it?
Search the .h and .cpp files used in your project.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Hi,
I'm trying to have a server application with listening socket on a defined port(e.g. 6000). The client application connects to the server on port 6000, and the server starts a new thread to deal with the client by creating a new socket also associated with port 6000. So what I want to happen is when the server gets a UDP on port 6000 if it is from the client then the socket in the spawned thread is used. If it is not from the original client then a new thread is spawned. Is this possible?
Thanks
|
|
|
|
|
No, I'm afraid you cant do this with datagram (UDP) sockets. you can do this with stream (tcp) sockets, by calling the accept() function, this will give you a new socket per connection, these sockets can then be passed to separate threads for processing.
The only way to do what you want is to have a single loop receiving packets with the recvfrom() function, this will return the address of the sender of the packet. then for each client, have a queue of that you put that packet into, have then a thread for each cleint that reads the next packet from the respective queue and processes it. Each thread can have a copy of the original socket handle so that they can send to their respective clients.
hope this helps.
|
|
|
|
|
Here's my next idea is this possible? The server has a UDP socket on port 6000 and spawns a new thread using creating a new socket using port 6001. By using the connect() method at the server the socket should filter all datagrams from all other clients. So in effect the server has multiple UDP sockets on port 6001.
Thanks
|
|
|
|
|
hmmm this may work, but the client would have to send the first packet to port 6000 and then all other packets to port 6001, what happens if the first packet doesnt arrive (udp is not reliable) at the destination and then the client will start sending to 6001 and the packets will get dropped.....
sounds like a bad plan to me.....
|
|
|
|
|
Hi,
Iam having a problem in one my scoket programe, when i am tring to connect to a particular IP address, it first get timed out but later it gets connected to the same IP address, can you plz suggest me what might be causing this.
but during the time out i have tried doing ping to the IP address i am connecting , i managed to successfully do a ping. I can't understand why i am getting timed out.
can any one of you guys suggest me on this.
cheers.
|
|
|
|
|
<b>Dear friends,
I am using Windows 2000 Professional & XP 2000
And I want to Access my Hard disk Sectors & Cluster,
I Used CreateFile (\\\\.\\C:,….) & ReadFile () Functions for read a Particular Drive only Sectors
I Used CreateFile(\\\\.\\PhysicalDrive0,….) & ReadFile() Function this Cannot work Handle Cannot Create Successfully
Now My problem is that I want to read MBR & Some Other Starting Sectors of My Hard disk Please Tell me what Can I do for That.
Advance
Thanks
Shaizi</b>
|
|
|
|
|
The MBR is the first sector of a physical drive.
Don't try it, just do it!
|
|
|
|
|
Hi
I am working in Win32 API SDK, at my program, I am hooking IE window and I am using my own BHO dll (whenever IE is open, dll will attach with IE browser) through this dll I want to save the complete web page without prompting the save as dialogbox. I tried by using as follows
HRESULT hr = m_pWebBrowser->ExecWB(OLECMDID_SAVEAS,
MSOCMDEXECOPT_DONTPROMPTUSER, NULL, NULL);
I used MSOCMDEXECOPT_DONTPROMPTUSER options, even though I am getting dialog box and even if try to save the web page through save as dialog box also, page is not saving. I am getting the error msg "This Web page could not be saved".
Can you please help me to save the complete web page without prompting save..as dialog box.
If Anyone help to get an answer for this, it would be very much helpful for me
|
|
|
|
|
can anyone tell me the difference between ATL, WTL, STL, and MFC. What should I use when i develop general windows applications?
|
|
|
|
|
STL is a set of template classes and functions which provide generic containers and algorithms.
ATL is a set of template classes to create COM components and also contains default implementation of some COM interfaces.
WTL is a windowing wrapper over ATL to create template based window applications.
« Superman »
|
|
|
|