problem using strtok_s

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cath8024
    New Member
    • Apr 2007
    • 7

    problem using strtok_s

    I was using Visual C++ 6.0, where strtok worked quite fine.
    But now i've been asked to use VS 2005 & i desperately need to use strtok_s. But during compilation, error is shown as 'strtok_s': identifier not found. i am comparatively new to VS 2005.

    could anyone please help me.
  • gpraghuram
    Recognized Expert Top Contributor
    • Mar 2007
    • 1275

    #2
    Originally posted by cath8024
    I was using Visual C++ 6.0, where strtok worked quite fine.
    But now i've been asked to use VS 2005 & i desperately need to use strtok_s. But during compilation, error is shown as 'strtok_s': identifier not found. i am comparatively new to VS 2005.

    could anyone please help me.
    strtok_s is thread safe version of strtok supported by POSIX.
    I dont know Microsoft VS supports the same
    Raghuram

    Comment

    • weaknessforcats
      Recognized Expert Expert
      • Mar 2007
      • 9214

      #3
      strtok_s should be declared in string.h in Visual Studio.NET 2005.

      I tried it on my mine and it works fine.

      Comment

      • cath8024
        New Member
        • Apr 2007
        • 7

        #4
        thanks for the reply.
        when i included #include <string> instead of #include <string.h>,
        the problem is solved.
        what is the difference between the files string and string.h

        Comment

        • gpraghuram
          Recognized Expert Top Contributor
          • Mar 2007
          • 1275

          #5
          Originally posted by cath8024
          thanks for the reply.
          when i included #include <string> instead of #include <string.h>,
          the problem is solved.
          what is the difference between the files string and string.h

          #include<string > is the c++ header file while string.h is the c header file.

          c++ version of string has a string class in it.

          Other members please add to this

          Raghuram

          Comment

          • cath8024
            New Member
            • Apr 2007
            • 7

            #6
            thanks.
            now that cleared my confusion & everything works just fine.

            Comment

            • weaknessforcats
              Recognized Expert Expert
              • Mar 2007
              • 9214

              #7
              Originally posted by gpraghuram
              c++ version of string has a string class in it.
              Not quite. The C++ version of the C header <string.h> is <cstring>.

              The C++ <string> header is strictly a C++ Standard Library header. There are no C string functions in there. Secure or otherwise.

              Comment

              Working...