• Navigation überspringen
  • Zur Navigation
  • Zum Seitenende
Organisationsmenü öffnen Organisationsmenü schließen
Lehrstuhl für Informatik 4 & 16
  • FAUZur zentralen FAU Website
  1. Friedrich-Alexander-Universität
  2. Technische Fakultät
  3. Department Informatik
  • English
  • Campo
  • UnivIS
  • Stellenangebote
  • Lageplan
  • Hilfe im Notfall
  1. Friedrich-Alexander-Universität
  2. Technische Fakultät
  3. Department Informatik

Lehrstuhl für Informatik 4 & 16

Menu Menu schließen
  • Lehrstuhl
    • Leitbild
    • Team
    • Kontakt und Anfahrt
    • 50-jähriges Jubiläum
    Portal Lehrstuhl
  • Forschung
    • Forschungsbereiche
      • Betriebssysteme
      • Echtzeitsysteme
      • Energiebewusste Systeme
      • Verteilte Systeme
    • Projekte
      • BFT2Chain
      • e.LARN
      • NEON
      • PAVE
      • PRIMaTE
      • REFIT
      • ResPECT
      • SURESOFT
      • TRR 89 C1: iRTSS
      • TRR 89 C5
      • Watwa
    • Projektkampagnen
      • DOSS
      • maRE
    • Forschungsgruppen
      • ergoo
    Portal Forschung
  • Publikationen
  • Lehre
    • Wintersemester 2022/23
      • Ausgewählte Kapitel der Systemsoftware
      • Betriebssysteme
      • Middleware – Cloud Computing
      • Systemnahe Programmierung in C (für Wiederholer)
      • Systemprogrammierung 1 (für Wiederholer)
      • Systemprogrammierung 2
      • Verlässliche Echtzeitsysteme
      • Virtuelle Maschinen
      • Web-basierte Systeme
    • Sommersemester 2023
      • Ausgewählte Kapitel der Systemsoftware
      • Betriebssystemtechnik
      • Projekt angewandte Systemsoftwaretechnik
      • Systemnahe Programmierung in C
      • Systemprogrammierung 1
      • Verteilte Systeme
    Portal Lehre
  • Examensarbeiten
  1. Startseite
  2. Lehre
  3. Wintersemester 2022/23
  4. Systemnahe Programmierung in C (für Wiederholer)
  5. Übung
  6. Linux libc-Doku

Linux libc-Doku

Bereichsnavigation: Lehre
  • Systemnahe Programmierung in C (für Wiederholer)
    • Vorlesung
      • Übung
        • Folien
        • Aufgaben
        • SPiCboard
          • Bauanleitung
            • Programmieren im CIP
              • Programmieren von zu Hause
                • libspicboard-Doku
                  • SPiC-IDE
                    • SPiCsim
                      • FAQ
                        • Projekte
                        • Linux libc-Doku
                        • Prüfung
                          • Klausurergebnisse
                          • Evaluation
                            • Intern

                            Linux libc-Doku

                            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
                            s string 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
                            dest buffer, where to copy to
                            src buffer 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
                            dest buffer, where to append to
                            src buffer to be appended
                            Returns
                            pointer to dest

                            Friedrich-Alexander-Universität
                            Erlangen-Nürnberg

                            Schlossplatz 4
                            91054 Erlangen
                            • Impressum
                            • Datenschutz
                            • Barrierefreiheit
                            Nach oben