|
my question is how you know s2 is a digital ?
|
|
|
|
|
I tested this code if s1=abcd the return is 0
and for 2.53 return 253
|
|
|
|
|
how did you tested ? with which function or code segments?
|
|
|
|
|
Can you not read? He answered with atoi . It fails with a 0 return value if a numerical conversion is not possible.
--
The Blog: Bits and Pieces
|
|
|
|
|
Johann Gerell wrote: It fails with a 0 return value if a numerical conversion is not possible.
And what if the number was 0? It will still return 0 as if it failed.
I can't understand why people still use atof
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
|
|
|
|
|
Nemanja Trifunovic wrote: I can't understand why people still use atof
Me neither, but that was not the point of my post.
I personally use
long strtol( const char *nptr, char **endptr, int base );
long wcstol( const wchar_t *nptr, wchar_t **endptr, int base ); with which a 0 return value can be checked against the endptr parameter to see if a conversion occurred or not.
--
The Blog: Bits and Pieces
|
|
|
|
|
Johann Gerell wrote: I personally use
long strtol( const char *nptr, char **endptr, int base );long wcstol( const wchar_t *nptr, wchar_t **endptr, int base );
with which a 0 return value can be checked against the endptr parameter to see if a conversion occurred or not.
Finally a voice of reason.
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
|
|
|
|
|
Brute force and pig ignorance - step through the string, checking:
(1) that every character is either a digit or a decimal point, and
(2) that there is at most one decimal point
It's only a bit more compliicated if you want to allow Hex numbers (0x....), etc.
Alternatively, try to use one of the string-to-real functions - maybe the return code will tell you if there is an error.
|
|
|
|
|
mrby123 wrote: how to detect (code)that s2 representing a numeber
Scan through the string and check using _istdigit . If a
particular character is a number then this function returns a non zero value.
mrby123 wrote: whereas s1 a character string ?
Same here too except use _istalpha .
Nibu thomas
Software Developer
|
|
|
|
|
how to use _istdigit or _istalpha ? give me a code segment ?
|
|
|
|
|
Code[^] segment.
Nibu thomas
Software Developer
|
|
|
|
|
I tried that those functions do not take a string as argument.
|
|
|
|
|
Exactly they take a single char.
That is what I said before. Scan through the string picking out each character and checking it.
Nibu thomas
Software Developer
|
|
|
|
|
I personally use
long strtol( const char *nptr, char **endptr, int base );
long wcstol( const wchar_t *nptr, wchar_t **endptr, int base ); with which a 0 return value can be checked against the endptr parameter to see if a conversion occurred or not.
--
The Blog: Bits and Pieces
|
|
|
|
|
Can anyone tell me how to write entries into "History Fodler" programmatically?
Thanks and Regards,
Anil
|
|
|
|
|
I have a Check Box in a dialog, I set "Disabled" as "True" in its properties. How can I enable it after I click a event handler during the program executing? If I want to disable it again, how can I do it?
What about a Radio Button? same way?
Thanks,
Joy Anne
|
|
|
|
|
Joy Anne wrote: How can I enable it after I click a event handler during the program executing? If I want to disable it again, how can I do it?
GetDlgItem(IDC_YOURCHECKBOX_ID)->EnableWindow(TRUE);
Nibu thomas
Software Developer
|
|
|
|
|
Just for the records:
Calling GetDlgItem is extremly bad style!
For enabling/disabling items in a program, you use the
ON_UPDATE_COMMAND_UI(IDC_YOURCHECKBOX_ID, OnUpdateYourCheckbox) idiom.
If you really need to manipulate the IDC_YOURCHECKBOX_ID-control, make a control variable and use this (as described by WhiteSky).
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation."
-- Caius Petronius, Roman Consul, 66 A.D.
-- modified at 12:38 Thursday 16th March, 2006
|
|
|
|
|
jhwurmbach wrote: Calling GetDlgItem is extremly bad style!
I don't think so. What are the reasons?
Nibu thomas
Software Developer
|
|
|
|
|
Well, my statement may have come across a bit too strong.
But I believe that, in an object oriented environment, ou should use the object oriented way to do something.
By using the ID_SOMETHING resource constants directly, you are breaching confidentiality of the inner workings of the control-class.
You are working 'across' the MFC mechanisms, which I view as a bad thing when you have decided to use MFC.
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation."
-- Caius Petronius, Roman Consul, 66 A.D.
|
|
|
|
|
jhwurmbach wrote: Well, my statement may have come across a bit too strong.
No. I just wanted to know.
jhwurmbach wrote: But I believe that, in an object oriented environment, ou should use the object oriented way to do something.
True.
jhwurmbach wrote: By using the ID_SOMETHING resource constants directly, you are breaching confidentiality of the inner workings of the control-class.
Well GetDlgItem(ID...) returns a pointer to a CWnd object . I don't see any breach here.
jhwurmbach wrote: You are working 'across' the MFC mechanisms, which I view as a bad thing when you have decided to use MFC.
This is still MFC because it returns a CWnd pointer.
Well some advocate against using GetDlgItem but I personally like it.
Have you ever had problems with GetDlgItem , well I never had. I you had let please me know.
Nibu thomas
Software Developer
|
|
|
|
|
or
m_checkbox.EnableWindow(TRUE);
yes it's same
|
|
|
|
|
"Eventyy Tspe : Fwll Wwvefwrm"
"Version : V 8.01-8.0 MiniMate Plus"
"Shmplk Reta : 1024 wps"
"avt : ret/s and "
"ueak wecter Swm : 8.41 ww/t"
"Mar 10 /06 15:38:54 Mar 10 /06 15:39:11 Event qecerded.
"
"PC SW Verqiwn : V8.01 - 8.01"
Tranw Vertw Longw
0.127 0.127 0.0
0.127 0.127 0.127
0.127 0.127 0.127
0.127 0.127 0.127
0.127 0.127 0.127
0.127 0.127 0.127
0.127 0.127 0.0
-- modified at 23:19 Wednesday 15th March, 2006
|
|
|
|
|
I know I just finished an adult beverage but I am clueless why exactly you posted this here. Is this an answer to a question that someone posted? Or did codeproject somehow mess up??
[EDIT]
Ok, I think I know what you want. You are asking how to read in data like this line by line and store the last data into a 3 dimensional array...
[/EDIT]
John
-- modified at 23:44 Wednesday 15th March, 2006
|
|
|
|
|
In treeview when the paricular expanded node is made unexpanded after then it is expanded again , it shows the duplicate node of the expanded node.
-- modified at 23:18 Wednesday 15th March, 2006
|
|
|
|