Problem on using strtok_s in Dev C++

Hi,

I cannot use strtok_s on Dev-C++ 5.11. it says 'strtok_s was not declared in this scope". Is it available on C++?
I tried the same code below in Visual Studio 2013 and it worked.

Thanks!!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
  #include <cstring>
#include <cstdio>
#include <iostream>
using namespace std;

int main(void)
{

	char string[] =
		"A string\t of ,,tokens\n and some  more tokens";

	char seps[] = " ,\t\n";
	char *token = NULL;
	char *Residual = NULL;

	cout<<"Tokens: "<<endl;

	// Establish string and get the first token:
	token = strtok_s(string, seps, &Residual);
	

	// While there are tokens in "string" 
	while ((token != NULL)) 
	{
		// Get next token:	
			cout<< token<<endl;
			token = strtok_s(NULL, seps, &Residual);
			cout << " *****" << Residual << "*****" << endl;
	}
	
char H; cin >> H;
return 0;
}
> Is it available on C++?

strtok_s() is not part of the standard C++ library.

It may be available as part of the standard C11 library (optional feature)
http://en.cppreference.com/w/c/string/byte/strtok
Topic archived. No new replies allowed.