12-14-2006 11:59 PM
12-15-2006 04:37 AM
A simple solution could use ANSI strtok ( ) function. I wrote this little code you can try even in the Interactive window. It needs to be trimmed a little to accomodate input and output to your actual application, but it should work as expected (note that the delimiter used changes from call to call to strtok function):
#include <utility.h>
#include <ansi_c.h>
static char src[256], *item;
strcpy (src, "<LL>Serial Number: <BB = \042COURIER NEW\042>NONE</JJ>");
DebugPrintf ("Source string: %s\n", src);
item = strtok (src, ">");
if (!item) DebugPrintf ("No delimiter found\n");
while (1) {
item = strtok (NULL, "<");
if (!item) break;
DebugPrintf ("%s", item);
item = strtok (NULL, ">");
if (!item) break;
}
DebugPrintf ("\nEnd of source string\n");
The output in the debug window is as follows:
Source string: <LL>Serial Number: <BB = "COURIER NEW">NONE</JJ>
Serial Number: NONE
End of source string