petsc-3.6.1 2015-08-06
Report Typos and Errors

PetscStrncpy

Copies a string up to a certain length

Synopsis

#include "petscsys.h"   
PetscErrorCode  PetscStrncpy(char s[],const char t[],size_t n)
Not Collective

Input Parameters

t - pointer to string
n - the length to copy

Output Parameter

s -the copied string

Note

Null string returns a string starting with zero

If the string that is being copied is of length n or larger then the entire string is not copied and the file location of s is set to NULL. This is different then the behavior of strncpy() which leaves s non-terminated.

See Also

PetscStrcpy(), PetscStrcat(), PetscStrncat()

Level:intermediate
Location:
src/sys/utils/str.c
Index of all Sys routines
Table of Contents for all manual pages
Index of all manual pages

Examples

src/tao/constrained/examples/tutorials/maros.c.html