Click here to Skip to main content
15,922,529 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionuse of _ltoa Pin
Kranti125198428-Feb-06 0:56
Kranti125198428-Feb-06 0:56 
AnswerRe: use of _ltoa Pin
Naveen28-Feb-06 1:04
Naveen28-Feb-06 1:04 
GeneralRe: use of _ltoa Pin
Kranti125198428-Feb-06 1:47
Kranti125198428-Feb-06 1:47 
GeneralRe: use of _ltoa Pin
Cedric Moonen28-Feb-06 2:02
Cedric Moonen28-Feb-06 2:02 
AnswerRe: use of _ltoa Pin
Cedric Moonen28-Feb-06 1:19
Cedric Moonen28-Feb-06 1:19 
AnswerRe: use of _ltoa Pin
mbue28-Feb-06 2:37
mbue28-Feb-06 2:37 
GeneralRe: use of _ltoa Pin
Kranti125198428-Feb-06 17:35
Kranti125198428-Feb-06 17:35 
QuestionDeleting a file to recycle bin Pin
Chintoo72328-Feb-06 0:44
Chintoo72328-Feb-06 0:44 
AnswerRe: Deleting a file to recycle bin Pin
Jack Puppy28-Feb-06 1:23
Jack Puppy28-Feb-06 1:23 
AnswerRe: Deleting a file to recycle bin Pin
mbue28-Feb-06 2:45
mbue28-Feb-06 2:45 
QuestionProgrammatically search for a file Pin
Anil_vvs28-Feb-06 0:44
Anil_vvs28-Feb-06 0:44 
AnswerRe: Programmatically search for a file Pin
Anil_vvs28-Feb-06 0:45
Anil_vvs28-Feb-06 0:45 
GeneralRe: Programmatically search for a file Pin
toxcct28-Feb-06 0:48
toxcct28-Feb-06 0:48 
GeneralRe: Programmatically search for a file Pin
James Brown28-Feb-06 1:52
James Brown28-Feb-06 1:52 
AnswerRe: Programmatically search for a file Pin
mbue28-Feb-06 2:49
mbue28-Feb-06 2:49 
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 

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.