• Navigation überspringen
  • Zur Navigation
  • Zum Seitenende
Organisationsmenü öffnen Organisationsmenü schließen
Friedrich-Alexander-Universität Lehrstuhl für Informatik 4 (Systemsoftware)
  • FAUZur zentralen FAU Website
  1. Friedrich-Alexander-Universität
  2. Technische Fakultät
  3. Department Informatik
Suche öffnen
  • English
  • Campo
  • StudOn
  • FAUdir
  • Stellenangebote
  • Lageplan
  • Hilfe im Notfall
  1. Friedrich-Alexander-Universität
  2. Technische Fakultät
  3. Department Informatik
Friedrich-Alexander-Universität Lehrstuhl für Informatik 4 (Systemsoftware)
Menu Menu schließen
  • Lehrstuhl
    • Team
    • Aktuelles
    • Kontakt und Anfahrt
    • Leitbild
    • 50-jähriges Jubiläum
    Portal Lehrstuhl
  • Forschung
    • Forschungsbereiche
      • Betriebssysteme
      • Confidential Computing
      • Embedded Systems Software
      • Verteilte Systeme
    • Projekte
      • AIMBOS
      • BALu
      • BFT2Chain
      • DOSS
      • Mirador
      • NEON
      • PAVE
      • ResPECT
      • Watwa
    • Projektkampagnen
      • maRE
    • Seminar
      • Systemsoftware
    Portal Forschung
  • Publikationen
  • Lehre
    • Wintersemester 2025/26
      • Systemprogrammierung 2
      • Betriebssysteme
      • Middleware – Cloud Computing
      • Echtzeitsysteme
      • Virtuelle Maschinen
      • Web-basierte Systeme
      • Projekt angewandte Systemsoftwaretechnik
      • Aktuelle Entwicklung in Verteilten und Objektorientierten Betriebssystemen (für Bachelor-/Masterarbeit)
    • Sommersemester 2026
      • Applied Software Architecture
      • Betriebssystemsicherheit
      • Betriebssystemtechnik
      • System-Level Programming
      • Systemnahe Programmierung in C
      • Systemprogrammierung 1
      • Verlässliche Echtzeitsysteme
      • Verteilte Systeme
    Portal Lehre
  • Examensarbeiten
  1. Startseite
  2. Extern

Extern

Bereichsnavigation: Lehre
  • System-Level Programming
    • Exam
      • Contact

    Linux libc-doc

    Files | Functions
    Strings

    Files

    file  string.h
     

    Functions

    size_t strlen (const char *s)
     Calculate the length of a string. More...
     
    char * strcpy (char *dest, const char *src)
     Copy a string. More...
     
    char * strcat (char *dest, const char *src)
     Append a string to another string. More...
     

    Detailed Description

    The functions in string.h allow for an easy manipulation of C strings. Always remember to allocate the memory for the trailing \0 after a C string and be aware, that strlen() does not include the terminating \0 in the string length.

    // allocate some memory
    char string_a[5+1], string_b[7+1];
    char string[5+7+1];
    // copy substrings into memory
    strcpy(string_a, "Hello");
    strcpy(string_b, " World!");
    // concatenate the two strings
    strcpy(string, string_a);
    strcat(string, string_b);
    printf("%s", string); // $> Hello World!
    // determine the length of the concatenated string
    size_t siz = strlen(string); // siz = 12 (5+7)
    printf
    int printf(const char *format,...)
    Print formatted data to stdout
    strcpy
    char * strcpy(char *dest, const char *src)
    Copy a string.
    strlen
    size_t strlen(const char *s)
    Calculate the length of a string.
    strcat
    char * strcat(char *dest, const char *src)
    Append a string to another string.

    Function Documentation

    size_t strlen ( const char *  s)

    The strlen() (string length) function calculates the length of the string pointed to by s, excluding the terminating \0.

    Parameters
    sstring under test
    Returns
    number of chars in s
    char* strcpy ( char *  dest,
    const char *  src 
    )

    The strcpy() (string copy) function copies the string pointed to by src, including the terminating \0, to the buffer pointed to by dest.

    The strings may not overlap, and the destination string dest must be large enough to receive the copy.

    Parameters
    destbuffer, where to copy to
    srcbuffer to be copied
    Returns
    pointer to dest
    char* strcat ( char *  dest,
    const char *  src 
    )

    The strcat() (string concatenate) function appends the string pointed to by src to the string pointed to by dest. Thereby, the terminating \0 of dest is overwritten. The concatenated string in dest is terminated by a \0 again.

    If dest is not large enough to include both strings, the program behavior is unpredictable.

    Parameters
    destbuffer, where to append to
    srcbuffer to be appended
    Returns
    pointer to dest
    Friedrich-Alexander-Universität
    Erlangen-Nürnberg

    Schlossplatz 4
    91054 Erlangen
    • Impressum
    • Datenschutz
    • Barrierefreiheit
    • Facebook
    • RSS Feed
    • Xing
    Nach oben