petsc-3.14.5 2021-03-03
Report Typos and Errors

# PetscStrallocpy

Allocates space to hold a copy of a string then copies the string

### Synopsis

    #include "petscsys.h"
    PetscErrorCode  PetscStrallocpy(const char s[],char *t[])

Not Collective

### Input Parameters

| s | - pointer to string

### Output Parameter

| t | - the copied string

### Note

Null string returns a new null string

Not for use in Fortran

Warning: If t has previously been allocated then that memory is lost, you may need to PetscFree() the array before calling this routine.

### See Also

PetscStrArrayallocpy(), PetscStrcpy(), PetscStrNArrayallocpy()

### Level

intermediate

### Location

src/sys/utils/str.c

### Examples

src/snes/tutorials/ex48.c.html
src/ts/tutorials/ex9.c.html
src/ts/tutorials/ex11.c.html
src/ts/tutorials/ex14.c.html
Index of all Sys routines
Table of Contents for all manual pages
Index of all manual pages