CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: strncpy_s

  1. #1
    Join Date
    Feb 2014
    Posts
    2

    Lightbulb strncpy_s

    error: 'strncpy_s' was not declared in this scope . compiling on ubuntu (linux). what is it?

  2. #2
    Join Date
    Jul 2005
    Location
    Netherlands
    Posts
    2,042

    Re: strncpy_s

    AFAIK, it's Microsoft specific. strncpy is standard.
    Cheers, D Drmmr

    Please put [code][/code] tags around your code to preserve indentation and make it more readable.

    As long as man ascribes to himself what is merely a posibility, he will not work for the attainment of it. - P. D. Ouspensky

  3. #3
    Join Date
    Feb 2014
    Posts
    2

    Re: strncpy_s

    If I use strncpy, then found other errors. Works only with strncpy_s
    part of code:
    std::strncpy_s(username, 40, text + 1, accend - 1);
    ...
    and:
    char days[10];

    if (text[1] == ' ')
    strncpy_s(days, 10, text, 1);
    else if (text[2] == ' ')
    strncpy_s(days, 10, text, 2);
    else if (text[3] == ' ')
    strncpy_s(days, 10, text, 3);
    else

    ...

  4. #4
    Join Date
    Apr 1999
    Posts
    27,449

    Re: strncpy_s

    Quote Originally Posted by XOM91K View Post
    If I use strncpy, then found other errors. Works only with strncpy_s
    Replace those calls with strncpy() and provide the correct parameters. See here:

    http://www.cplusplus.com/reference/cstring/strncpy/

    Second, this is the Visual C++ forum -- issues with another compiler should be directed to the Non-Visual C++ forum.

    Last, an operating system is not a compiler -- mentioning "Ubuntu" and Linux" doesn't tell us what compiler and version of the compiler you're using. More than likely it is gcc / g++.

    Regards,

    Paul McKenzie

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured