User forums > Help

strcpy_s

(1/1)

Ducky:
Hello!

Im trying to compile this simple example with strcpy_s and getting

`strcpy_s' was not declared in this scope error.

If i use the "old" strcpy, it works.


--- Code: ---#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>

int main( void )
{
   char string[80];
   // using template versions of strcpy_s and strcat_s:
   strcpy_s( string, "Hello world from " );
   strcat_s( string, "strcpy_s " );
   strcat_s( string, "and " );
   // of course we can supply the size explicitly if we want to:
   strcat_s( string, _countof(string), "strcat_s!" );

   printf( "String = %s\n", string );
}
--- End code ---

Jenna:
This forum is dedicated to C::B related questions only.

It's not a general programming forum.

Sorry.

Topic locked !

Navigation

[0] Message Index

Go to full version