Thread: Researching how to best import CSV and separate content

  1. #46
    Ticked and off
    Join Date
    Oct 2011
    Location
    La-la land
    Posts
    1,728
    Quote Originally Posted by laserlight View Post
    Not quite: strtok_r does not have the size parameter that is found in strtok_s.
    Are you sure? The strtok_s() I found at MSDN does not have a size parameter; it is declared exactly like POSIX.1-2001 strtok_r() is.

  2. #47
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Yes, the standardised version of strtok_s does have a second parameter for size. So maybe the Microsoft advocates were not entirely able to get their way.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #48
    Ticked and off
    Join Date
    Oct 2011
    Location
    La-la land
    Posts
    1,728
    Quote Originally Posted by laserlight View Post
    Yes, the standardised version of strtok_s does have a second parameter for size.
    Oh, you were talking about the standard C11 strtok_s(), and not the strtok_s() Microsoft has implemented and calls standard. You should have mentioned it the first time you referred to it; I assumed you were still referring to the Microsoft strtok_s() mentioned earlier.

    Okay, I think we're in agreement that POSIX.1-2001 strtok_r() and Microsoft strtok_s() (Visual Studio 2005 to 2013) have the exact same interface.

    The strtok_s() function, as defined by the C11 standard, has an additional size parameter. The support for this (and other similar functions) is optional, indicated by __STD_LIB_EXT1__, and the function is only declared if __STDC_WANT_LIB_EXT1__ is defined prior to including string.h .

    Which, in my opinion, makes it an even more reason to use the preprocessor compatibility magic I showed much earlier, and strtok_r().

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Researching C++ - Your Opinions Wanted Here!
    By McCrockett in forum C++ Programming
    Replies: 2
    Last Post: 11-08-2012, 09:38 AM
  2. How to import DLL function from a separate C file
    By high123_98 in forum C++ Programming
    Replies: 7
    Last Post: 11-12-2011, 11:57 AM
  3. ASM dll import
    By borko_b in forum C Programming
    Replies: 1
    Last Post: 04-03-2003, 12:15 AM
  4. Import Dll
    By Shakespeare in forum C++ Programming
    Replies: 2
    Last Post: 01-27-2003, 05:40 AM
  5. NT Service - researching...
    By schu777 in forum Windows Programming
    Replies: 3
    Last Post: 03-25-2002, 02:58 PM

Tags for this Thread