Chris
Chris

Reputation: 13

strchrnul on visual studio c++?

I recently received an old source code from a port scanner program that worked in the old Visual Studio, but this source does not work in Visual Studio 2019.

p = strchrnul(h, ',');

The strchrnul function is not inside the string.h header file. Can any of you help replace this function ? I have no knowledge of text in cpp

Upvotes: 1

Views: 299

Answers (1)

Jeremy Friesner
Jeremy Friesner

Reputation: 73379

You can write your own strchnul() implementation easily enough:

char * strchnul(const char * s, int c)
{
   while(*s)
   {
      if (c == *s) break;
      s++;
   }
   return const_cast<char *>(s);
}

Upvotes: 2

Related Questions