Strok not declared in this scope

Howdy all,

I’m having an issue using strok to pull a string of chars apart on an ESP32, using the Arduino IDE.

Here’s the code so far :

#include "string.h"

String inboundText = "2,4,6";

void setup() {

  char buf[100];
  char delimiter = ',';

  char* ptr = strok(buf,delimiter);
    printf("found one part: %s/n",ptr);
    //create the next part
    ptr = strok(NULL, delimiter);  

The code won’t compile, saying “‘strok’ was not declared in this scope”.

I’ve searched high and low, added every reference under the sun, but still can’t get this to work.

Any help would be greatly appreciated.



strtok();   // not strok();

-jim lee

Oh wow, Jim, I feel so embarrassed. Thank you so much. No wonder I couldn’t find any references on the web.



I found it by searching for one i knew, strlen(), and figured it would be a nearby neighbor. It was.

-jim lee

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.