Click here to Skip to main content
15,910,083 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to load whole file to a CStringEx object ? Pin
Stephane Rodriguez.30-Oct-02 11:17
Stephane Rodriguez.30-Oct-02 11:17 
GeneralI need to detect a float Pin
ns30-Oct-02 11:09
ns30-Oct-02 11:09 
GeneralRe: I need to detect a float Pin
S van Leent30-Oct-02 11:13
S van Leent30-Oct-02 11:13 
GeneralRe: I need to detect a float Pin
alex.barylski30-Oct-02 11:13
alex.barylski30-Oct-02 11:13 
GeneralRe: I need to detect a float Pin
markkuk30-Oct-02 11:34
markkuk30-Oct-02 11:34 
GeneralRe: I need to detect a float Pin
alex.barylski30-Oct-02 14:39
alex.barylski30-Oct-02 14:39 
GeneralRe: I need to detect a float Pin
ns31-Oct-02 1:18
ns31-Oct-02 1:18 
GeneralRe: I need to detect a float Pin
Christian Graus30-Oct-02 11:15
protectorChristian Graus30-Oct-02 11:15 
As is often said, if you expressed what you want in plain english, it would be obvious to you.

bool IsFloat( LPCTSTR pszText )
{
ASSERT_VALID_STRING( pszText );
const int nLen = lstrlen( pszText );
int nDots = 0;
for( int i = 0; i < nLen ); i++ )
{
if (pszText[i] == '.')
++ nDots;
else if( !_istdigit( pszText[ i ] ))
return false;
}


return (nDots < 2);
}

That will return true for int and float, make it return (nDots == 1) to be true for float only.

Note, I did this in CP, it is untested, but the idea is sound.


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

During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
GeneralThank you! Pin
ns31-Oct-02 1:15
ns31-Oct-02 1:15 
GeneralRe: I need to detect a float Pin
ns31-Oct-02 1:54
ns31-Oct-02 1:54 
Generaldeadlock woes Pin
mystro_AKA_kokie30-Oct-02 11:06
mystro_AKA_kokie30-Oct-02 11:06 
GeneralRe: deadlock woes Pin
User 988530-Oct-02 12:53
User 988530-Oct-02 12:53 
GeneralHelp with ListView Control Pin
Steven M Hunt30-Oct-02 11:06
Steven M Hunt30-Oct-02 11:06 
GeneralRe: Help with ListView Control Pin
alex.barylski30-Oct-02 11:11
alex.barylski30-Oct-02 11:11 
GeneralRe: Help with ListView Control Pin
Anonymous30-Oct-02 11:36
Anonymous30-Oct-02 11:36 
GeneralRe: Help with ListView Control Pin
Steven M Hunt30-Oct-02 13:52
Steven M Hunt30-Oct-02 13:52 
Generalreal time audio encoding/decoding over a network Pin
ascherchen30-Oct-02 10:58
ascherchen30-Oct-02 10:58 
GeneralRe: real time audio encoding/decoding over a network Pin
Stephane Rodriguez.30-Oct-02 11:13
Stephane Rodriguez.30-Oct-02 11:13 
Generalatoi(123.567) Pin
ns30-Oct-02 10:54
ns30-Oct-02 10:54 
GeneralRe: atoi(123.567) Pin
Christian Graus30-Oct-02 10:58
protectorChristian Graus30-Oct-02 10:58 
GeneralRe: atoi(123.567) Pin
alex.barylski30-Oct-02 11:00
alex.barylski30-Oct-02 11:00 
GeneralRe: atoi(123.567) Pin
ian mariano30-Oct-02 21:41
ian mariano30-Oct-02 21:41 
GeneralRe: atoi(123.567) Pin
alex.barylski30-Oct-02 22:35
alex.barylski30-Oct-02 22:35 
GeneralRe: atoi(123.567) Pin
S van Leent30-Oct-02 11:10
S van Leent30-Oct-02 11:10 
GeneralXML using DOM Pin
Anonymous30-Oct-02 10:45
Anonymous30-Oct-02 10:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.