How to use Array and print all values on MPLAB C Compiler? -
i using mplab c18 compiler pic18. problem can't print values though code works 100% on codeblocks. spent more 3 hours googling problem , don't understand what's causing it. how output looks on both compilers.
mplab output
2
codeblocks output
2
100
200
100
code
char somestr[] ="2,0100,0200,0100"; char *pt; int a; pt = strtok (somestr,","); while (pt != null) { = atoi(pt); printf("%d\n", a); pt = strtok (null, ","); }
thank responses, appropriate it. found solution , share it. instead of strtok used strtokpgmram.
final code
char somestr[] ="2,0100,0200,0100"; char *pt; int a; pt = strtokpgmram (somestr,","); while (pt != null) { = atoi(pt); printf("%d\n", a); pt = strtokpgmram(null, ","); }
Comments
Post a Comment