Click here to Skip to main content
16,010,392 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Parsing in C Pin
Rickard Andersson2026-May-03 0:30
Rickard Andersson2026-May-03 0:30 
GeneralRe: Parsing in C Pin
Paul Hooper26-May-03 1:51
Paul Hooper26-May-03 1:51 
GeneralRe: Parsing in C Pin
Rage25-May-03 23:46
professionalRage25-May-03 23:46 
GeneralRe: Parsing in C Pin
Rickard Andersson2026-May-03 0:32
Rickard Andersson2026-May-03 0:32 
GeneralRe: Parsing in C Pin
Ryan Binns26-May-03 1:46
Ryan Binns26-May-03 1:46 
GeneralRe: Parsing in C Pin
jhwurmbach26-May-03 2:19
jhwurmbach26-May-03 2:19 
GeneralRe: Parsing in C Pin
Ryan Binns26-May-03 2:22
Ryan Binns26-May-03 2:22 
GeneralRe: Parsing in C Pin
Rickard Andersson2026-May-03 5:27
Rickard Andersson2026-May-03 5:27 
Thank you very much!
I've updated the code, here is the updated version:

void HotIceParser(const char* command, const int len, PHIPD phipd)
{
	char* buffert = NULL;
	char* p1 = NULL;
	const char* p2 = NULL;

#ifdef DEBUG_MODE
	assert(phipd != NULL);
	assert(len < MAX_BUFFERT+1);
	assert(len != 0);
#endif
	
	buffert = (char*)malloc(len);
	ZeroMemory(buffert, len);
	p1 = &buffert[0];
	p2 = &command[0];

	/* Find the command */
	while((*p2 != ' ') && (*p2 != '\0'))
		*p1++ = *p2++;

	if(strcmp(buffert, HIC_LUC) == 0)
	{
		phipd->type = LUC;
		p1 = &buffert[0];
		p2++;
		while((*p2 != ' ') && (*p2 != '\0'))
			*p1++ = *p2++;

		*p1 = '\0';
		strcpy(phipd->luc.pszIP, buffert);
	}
	free(buffert);
}


Is there anything that you think is done wrong or so?

One thing I don't really understand is:

while((*p2 != ' ') && (*p2 != '\0'))
		*p1++ = *p2++;


Is command contains this: "luc 192.168.244.151 4000 50 mypass".
Then it only run the loop 3 times because it is supposed to find 'luc'. If I remove "&& (*p2 != '\0')" it will loop many times, I don't know how many but many! With "&& (*p2 != '\0')" I will understand it as it would keep iterate until '\0' is also found... but it doesn't. I did wrote the code by myself but I don't really understand it correctly! Big Grin | :-D

Rickard Andersson8
Here is my card, contact me later!

UIN: 50302279
E-Mail: nikado@pc.nu
Interests: C++, ADO, SQL, Winsock, 0s and 1s


GeneralSimple get started questions Pin
Jon H25-May-03 22:44
Jon H25-May-03 22:44 
GeneralRe: Simple get started questions Pin
Andrew Walker25-May-03 23:32
Andrew Walker25-May-03 23:32 
Generalunicode, resources Pin
Joerg Wiedenmann25-May-03 22:24
Joerg Wiedenmann25-May-03 22:24 
GeneralRe: unicode, resources Pin
John R. Shaw26-May-03 10:29
John R. Shaw26-May-03 10:29 
GeneralConstruct Null Object If I/O Operation Fail In The Constructor Pin
yccheok25-May-03 22:22
yccheok25-May-03 22:22 
GeneralRe: Construct Null Object If I/O Operation Fail In The Constructor Pin
Andrew Walker25-May-03 22:38
Andrew Walker25-May-03 22:38 
GeneralRe: Construct Null Object If I/O Operation Fail In The Constructor Pin
Ryan Binns26-May-03 1:59
Ryan Binns26-May-03 1:59 
GeneralDebugging OLE Automation Application Pin
vcseeker25-May-03 22:22
vcseeker25-May-03 22:22 
GeneralFormat of the Visual C++ Intellisense File Pin
Franz Klein25-May-03 21:58
Franz Klein25-May-03 21:58 
GeneralWhy my activex ctrl(MFC,not ATL) can only run at IE6 Pin
fengjn25-May-03 21:26
fengjn25-May-03 21:26 
QuestionHow to get the index of the current hot item of the CListCtrl? Pin
iamhcj25-May-03 20:54
iamhcj25-May-03 20:54 
AnswerRe: How to get the index of the current hot item of the CListCtrl? Pin
Michael Dunn25-May-03 22:30
sitebuilderMichael Dunn25-May-03 22:30 
GeneralReally strange problem , solution !!! :-) Pin
Cedric Moonen25-May-03 20:53
Cedric Moonen25-May-03 20:53 
GeneralRe: Really strange problem , solution !!! :-) Pin
Rage25-May-03 22:39
professionalRage25-May-03 22:39 
GeneralRe: Really strange problem , solution !!! :-) Pin
Neville Franks25-May-03 22:46
Neville Franks25-May-03 22:46 
GeneralGet File Type Extenstons.......... Pin
rohit.dhamija25-May-03 20:44
rohit.dhamija25-May-03 20:44 
GeneralRe: Get File Type Extenstons.......... Pin
Rage25-May-03 22:57
professionalRage25-May-03 22:57 

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.