4 ms·
You could avoid the copy out of the JSON string by using a field width specifier in your printf formatting string. Those should be available in ANSI C / C89/90.
by robmccoll 7y ago
You could avoid the copy out of the JSON string by using a field width specifier in your printf formatting string. Those should be available in ANSI C / C89/90.
currentToken = tokens[index];
tokenSize = currentToken.end - currentToken.start;
if(tokenSize <= 0){ continue; }
printf("Current token %.*s\n", tokenSize, startOfJson + currentToken.start);
- vardump 7y agoOne of those things usually only people who've written printf format parser know.
- yeokm1 7y agoThe printf is just for example code. In actual fact, I'll have to copy the data to a char array to be sent to display in the listbox.
- robmccoll 7y agoFair enough. I read this quite literally and thought "not exactly": > hence I need to use those values to copy out from memory to a separate char array for printing purposes. Certainly not so trivial.