petsc-3.7.1 2016-05-15
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 Many br

### Input Parameters

| t | - pointer to string Many br
| n | - the length to copy Many br

### Output Parameter

s -the copied string Many br

Many br

### Note

Null string returns a string starting with zero Many br

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

### 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/dm/impls/forest/examples/tutorials/ex1.c.html
src/tao/constrained/examples/tutorials/maros.c.html