| 1 | ////////////////////////////////////////////////////////////////////////////////// | 
|---|
| 2 | // File     : string.h  | 
|---|
| 3 | // Date     : 23/05/2013 | 
|---|
| 4 | // Author   : Alexandre JOANNOU, Laurent LAMBERT | 
|---|
| 5 | // Copyright (c) UPMC-LIP6 | 
|---|
| 6 | /////////////////////////////////////////////////////////////////////////////////// | 
|---|
| 7 |  | 
|---|
| 8 | #ifndef _STRING_H | 
|---|
| 9 | #define _STRING_H | 
|---|
| 10 |  | 
|---|
| 11 | //////////////////////////////////////////////////////////////////////////////////////// | 
|---|
| 12 | // This function copies the source string to the dest string, including the NUL  | 
|---|
| 13 | // terminating character. | 
|---|
| 14 | // It returns a pointer on the dest string. | 
|---|
| 15 | //////////////////////////////////////////////////////////////////////////////////////// | 
|---|
| 16 | char * strcpy(char * destination, const char * source); | 
|---|
| 17 |  | 
|---|
| 18 | //////////////////////////////////////////////////////////////////////////////////////// | 
|---|
| 19 | // The strncpy() function is similar to strcpy, except that at most n bytes of src | 
|---|
| 20 | // are copied. If there is no null byte among the first n bytes of src, the string | 
|---|
| 21 | // placed in dest will not be null terminated. | 
|---|
| 22 | //////////////////////////////////////////////////////////////////////////////////////// | 
|---|
| 23 | char * strncpy(char * dest, const char * src, int n); | 
|---|
| 24 |  | 
|---|
| 25 | //////////////////////////////////////////////////////////////////////////////////////// | 
|---|
| 26 | // The strcmp() function compares the two strings s1 and s2.  It returns an integer  | 
|---|
| 27 | // less than, equal to, or greater than zero if s1 is found, respectively, to be smaller | 
|---|
| 28 | // to match, or be greater than s2. | 
|---|
| 29 | //////////////////////////////////////////////////////////////////////////////////////// | 
|---|
| 30 | int strcmp(const char * str1, const char * str2); | 
|---|
| 31 |  | 
|---|
| 32 | //////////////////////////////////////////////////////////////////////////////////////// | 
|---|
| 33 | // This function returns the number of characters in a string. | 
|---|
| 34 | // The terminating NULL character is not taken into account. | 
|---|
| 35 | //////////////////////////////////////////////////////////////////////////////////////// | 
|---|
| 36 | int strlen(const char * str); | 
|---|
| 37 |  | 
|---|
| 38 | //////////////////////////////////////////////////////////////////////////////////////// | 
|---|
| 39 | // The strchr() function returns a pointer to the first occurrence of the character c | 
|---|
| 40 | // in the string s. | 
|---|
| 41 | //////////////////////////////////////////////////////////////////////////////////////// | 
|---|
| 42 | char * strchr(const char * str, int c); | 
|---|
| 43 |  | 
|---|
| 44 | #endif | 
|---|
| 45 |  | 
|---|
| 46 | // Local Variables: | 
|---|
| 47 | // tab-width: 4 | 
|---|
| 48 | // c-basic-offset: 4 | 
|---|
| 49 | // c-file-offsets:((innamespace . 0)(inline-open . 0)) | 
|---|
| 50 | // indent-tabs-mode: nil | 
|---|
| 51 | // End: | 
|---|
| 52 | // vim: filetype=c:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 | 
|---|