Click here to Skip to main content
15,918,742 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Subclassing.......heh heh heh Pin
Joaquín M López Muñoz13-Nov-02 12:23
Joaquín M López Muñoz13-Nov-02 12:23 
Questionhow do you call updateallviews() from a dialog class? Pin
jack113-Nov-02 11:54
jack113-Nov-02 11:54 
AnswerRe: how do you call updateallviews() from a dialog class? Pin
valikac13-Nov-02 12:26
valikac13-Nov-02 12:26 
GeneralFrom primitive type to string Pin
S van Leent13-Nov-02 11:26
S van Leent13-Nov-02 11:26 
GeneralRe: From primitive type to string Pin
Joaquín M López Muñoz13-Nov-02 11:30
Joaquín M López Muñoz13-Nov-02 11:30 
GeneralRe: From primitive type to string Pin
S van Leent14-Nov-02 5:18
S van Leent14-Nov-02 5:18 
GeneralRe: From primitive type to string Pin
Joaquín M López Muñoz14-Nov-02 7:33
Joaquín M López Muñoz14-Nov-02 7:33 
GeneralRe: From primitive type to string Pin
S van Leent14-Nov-02 12:01
S van Leent14-Nov-02 12:01 
You're right, I can find it. I looked it somewhat and made my own code doing it.

I've just finished the String to Integer algorithm.

int String::ToInteger(String string)
{
	size_t index = 0;
	bool leadSpace = true;
	bool isValue = true;
	bool minus = false;
	int value = 0;
	
	try
	{
		// first scanning if the string has non-numbers
		while(leadSpace)
		{
			TCHAR tcRet = string.GetCharAt(index);
			if (((tcRet < TEXT('0')) || (tcRet > TEXT('9')) ) &&
				(tcRet != TEXT('-')) && (tcRet != TEXT('+')))
			{
				index++;
			}
			else
			{
				leadSpace = false;
			}
		}

		// scan whether the first character is equal to '-' (45) or '+' (43)
		TCHAR tcRet = string.GetCharAt(index);
		if (tcRet == TEXT('-'))
		{
			minus = true;
			index++;
		}
		else if (tcRet == TEXT('+'))
		{
			index++;
		}

		// OK, now a number begins, I hope, if no number is found after the minus
		// or plus sign, we immediatly return 0

		while (isValue)
		{
			TCHAR tcRet = string.GetCharAt(index);
			if (tcRet >= TEXT('0') && tcRet <= TEXT('9'))
			{
				int hold = (int)tcRet - (int)TEXT('0');
				value *= 10;
				value += hold;
				index++;
			}
			else
			{
				if (minus)
					return -value;
				else
					return value;
			}
		}

	}
	catch (Exception ex)
	{
		throw (ex);
	}

	return 0;
}


this is the code I'm using now to do it (if someone likes it, just use it) I'm now working on ToDouble, ToBoolean (easy!), ToUnsignedInteger, etc...

Sjoerd van Leent

LPCTSTR Dutch = TEXT("Double Dutch Smile | :) ");
GeneralDo I need to delete a CArray Pin
Code4Food13-Nov-02 11:22
Code4Food13-Nov-02 11:22 
GeneralRe: Do I need to delete a CArray Pin
Joaquín M López Muñoz13-Nov-02 11:32
Joaquín M López Muñoz13-Nov-02 11:32 
GeneralRe: Do I need to delete a CArray Pin
Code4Food13-Nov-02 11:38
Code4Food13-Nov-02 11:38 
GeneralRe: Do I need to delete a CArray Pin
Joaquín M López Muñoz13-Nov-02 11:47
Joaquín M López Muñoz13-Nov-02 11:47 
GeneralRe: Do I need to delete a CArray Pin
Code4Food13-Nov-02 11:56
Code4Food13-Nov-02 11:56 
GeneralRe: Do I need to delete a CArray Pin
Christian Graus13-Nov-02 12:11
protectorChristian Graus13-Nov-02 12:11 
GeneralRe: Do I need to delete a CArray Pin
Joaquín M López Muñoz13-Nov-02 12:16
Joaquín M López Muñoz13-Nov-02 12:16 
GeneralRe: Do I need to delete a CArray Pin
Christian Graus13-Nov-02 12:38
protectorChristian Graus13-Nov-02 12:38 
GeneralRe: Do I need to delete a CArray Pin
Code4Food13-Nov-02 12:27
Code4Food13-Nov-02 12:27 
GeneralRe: Do I need to delete a CArray Pin
Christian Graus13-Nov-02 12:43
protectorChristian Graus13-Nov-02 12:43 
GeneralRe: Do I need to delete a CArray Pin
Code4Food13-Nov-02 18:05
Code4Food13-Nov-02 18:05 
GeneralRe: Do I need to delete a CArray Pin
Christian Graus13-Nov-02 18:17
protectorChristian Graus13-Nov-02 18:17 
QuestionHow to use the UTILITY PROJECT in VC++ Pin
youssef13-Nov-02 11:12
youssef13-Nov-02 11:12 
GeneralImage list Pin
electronicman_x13-Nov-02 10:00
electronicman_x13-Nov-02 10:00 
GeneralRe: Image list Pin
Joaquín M López Muñoz13-Nov-02 10:19
Joaquín M López Muñoz13-Nov-02 10:19 
GeneralUI thread basics.. Pin
RobJones13-Nov-02 9:46
RobJones13-Nov-02 9:46 
GeneralRe: UI thread basics.. Pin
Joaquín M López Muñoz13-Nov-02 10:06
Joaquín M López Muñoz13-Nov-02 10:06 

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.