News for hackers. Stuff that matters.
Re:Building a new Windows 3.1 app in 2019: A Slack Client by robmccoll on Thursday December 19, 2019 @08:05AM (#21834525)
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);
Re:Building a new Windows 3.1 app in 2019: A Slack Client by vardump on Thursday December 19, 2019 @09:11AM (#21834996)
One of those things usually only people who've written printf format parser know.
Re:Building a new Windows 3.1 app in 2019: A Slack Client by yeokm1 on Thursday December 19, 2019 @10:04AM (#21835446)
The 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.

Re:Building a new Windows 3.1 app in 2019: A Slack Client by robmccoll on Thursday December 19, 2019 @10:20AM (#21835586)
Fair 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.