Click here to Skip to main content
15,905,874 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Programmatically search for a file Pin
Anil_vvs28-Feb-06 2:54
Anil_vvs28-Feb-06 2:54 
GeneralRe: Programmatically search for a file Pin
mbue28-Feb-06 3:32
mbue28-Feb-06 3:32 
QuestionData string Parsing Pin
srija28-Feb-06 0:42
srija28-Feb-06 0:42 
AnswerRe: Data string Parsing Pin
toxcct28-Feb-06 0:47
toxcct28-Feb-06 0:47 
GeneralRe: Data string Parsing Pin
srija28-Feb-06 1:34
srija28-Feb-06 1:34 
GeneralRe: Data string Parsing Pin
srija28-Feb-06 1:37
srija28-Feb-06 1:37 
AnswerRe: Data string Parsing Pin
Naveen28-Feb-06 0:59
Naveen28-Feb-06 0:59 
AnswerRe: Data string Parsing Pin
mbue28-Feb-06 3:30
mbue28-Feb-06 3:30 
I hope to understand you right. The aim is to convert a variable length block of input data with hexadecimal numbers into an array to integers. If it' true try this:

<br />
// comment: lp must be null terminated<br />
void ParseBlock(const char* lp)<br />
{<br />
	CArray<int,int>	a;<br />
	unsigned int	i,n;<br />
	int						result;<br />
	for(i=0;lp[i];i+=n)<br />
	{<br />
		if(!(n=ParseOneValue(lp+i,result)) break;<br />
		a.Add( result );<br />
	}<br />
}<br />
<br />
unsigned int ParseOneValue(const char* lp,int& result)<br />
{<br />
	unsigned int	i;<br />
	char*					e;<br />
	while(lp[i] && !isdigit(lp[i])) ++i; // trim leading non number chars<br />
	if(!lp[i]) return 0;<br />
	if((lp[i]!='0')||(lp[i]!='x')) // lp+i != "0x" hex prefix<br />
	{<br />
		// it seems to be decimal number<br />
		result = strtol(lp+i,&e,10);<br />
		return e-lp;<br />
	}<br />
	i += 2;<br />
	result = strtol(lp+i,&e,16);<br />
	return e-lp;<br />
}


sorry the html won't take the tabs.
GeneralRe: Data string Parsing Pin
srija1-Mar-06 3:05
srija1-Mar-06 3:05 
Questiondoubt in connecting dialog to MDI Pin
mailsafe28-Feb-06 0:26
mailsafe28-Feb-06 0:26 
AnswerRe: doubt in connecting dialod to MDI Pin
David Crow28-Feb-06 2:45
David Crow28-Feb-06 2:45 
AnswerRe: doubt in connecting dialod to MDI Pin
mbue28-Feb-06 3:39
mbue28-Feb-06 3:39 
QuestionFocusless window - how to make that? Pin
midix28-Feb-06 0:13
midix28-Feb-06 0:13 
AnswerRe: Focusless window - how to make that? Pin
mbue28-Feb-06 0:22
mbue28-Feb-06 0:22 
GeneralRe: Focusless window - how to make that? Pin
midix28-Feb-06 3:35
midix28-Feb-06 3:35 
GeneralRe: Focusless window - how to make that? Pin
mbue28-Feb-06 13:27
mbue28-Feb-06 13:27 
QuestionGutmann Algorithm Pin
rajeevktripathi27-Feb-06 23:41
rajeevktripathi27-Feb-06 23:41 
AnswerRe: Gutmann Algorithm Pin
Trollslayer28-Feb-06 22:54
mentorTrollslayer28-Feb-06 22:54 
QuestionEnvironment Variable Pin
Anil_vvs27-Feb-06 23:41
Anil_vvs27-Feb-06 23:41 
AnswerRe: Environment Variable Pin
toxcct27-Feb-06 23:46
toxcct27-Feb-06 23:46 
AnswerRe: Environment Variable Pin
mbue28-Feb-06 0:08
mbue28-Feb-06 0:08 
GeneralRe: Environment Variable Pin
toxcct28-Feb-06 0:10
toxcct28-Feb-06 0:10 
GeneralRe: Environment Variable Pin
Cedric Moonen28-Feb-06 0:39
Cedric Moonen28-Feb-06 0:39 
GeneralRe: Environment Variable Pin
toxcct28-Feb-06 0:42
toxcct28-Feb-06 0:42 
GeneralRe: Environment Variable Pin
Abebe28-Feb-06 2:34
Abebe28-Feb-06 2:34 

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.