Falando um pouco de Biblioteca em C:
Os arquivos de biblioteca tem a extensão .h (header) e os arquivos que programamos na linguagem c usam a extensão .c.
Quando criamos um programa que precisa usar uma função de sistema somos obrigados a incluir o cabeçalho da biblioteca que contém a função desejada.
Por exemplo, para criar um programa que mostre mensagens na tela usamos a função printf(). Como ela está contida na biblioteca stdio somos obrigados a incluir essa biblioteca no começo do nosso programa.
Biblioteca stdio
File access:
Formatted input/output:
Character input/output:
Direct input/output:
File positioning:
Error-handling:
Pseudo-random sequence generation:
Dynamic memory management:
Environment:
Searching and sorting:
Integer arithmethics:
Multibyte characters:
Multibyte strings:
stdio.h (acrônimo de standard input/output header ) é uma biblioteca que contém funções, macros e constantes padrões ao compilador.
Todo programa em C que usar funções para entrada ou saída de dados como o resgate de valores digitados pelo usuário ou então exibição de mensagens de retorno exigirá a inclusão do cabeçalho stdio.h
Uma lista de Funções da biclioteca sdtio
Functions
Operations on files:- remove
- Remover o arquivo (function )
- rename
- Rename file (function )
- tmpfile
- Open a temporary file (function)
- tmpnam
- Generate temporary filename (function)
File access:
- fclose
- Close file (function)
- fflush
- Flush stream (function)
- fopen
- Open file (function )
- freopen
- Reopen stream with different file or mode (function )
- setbuf
- Set stream buffer (function )
- setvbuf
- Change stream buffering (function )
Formatted input/output:
- fprintf
- Write formatted output to stream (function )
- fscanf
- Read formatted data from stream (function )
- printf
- Print formatted data to stdout (function )
- scanf
- Read formatted data from stdin (function )
- sprintf
- Write formatted data to string (function )
- sscanf
- Read formatted data from string (function )
- vfprintf
- Write formatted variable argument list to stream (function )
- vprintf
- Print formatted variable argument list to stdout (function )
- vsprintf
- Print formatted variable argument list to string (function )
Character input/output:
- fgetc
- Get character from stream (function)
- fgets
- Get string from stream (function )
- fputc
- Write character to stream (function)
- fputs
- Write string to stream (function)
- getc
- Get character from stream (function)
- getchar
- Get character from stdin (function)
- gets
- Get string from stdin (function )
- putc
- Write character to stream (function)
- putchar
- Write character to stdout (function)
- puts
- Write string to stdout (function)
- ungetc
- Unget character from stream (function)
Direct input/output:
- fread
- Read block of data from stream (function )
- fwrite
- Write block of data to stream (function)
File positioning:
- fgetpos
- Get current position in stream (function)
- fseek
- Reposition stream position indicator (function)
- fsetpos
- Set position indicator of stream (function)
- ftell
- Get current position in stream (function)
- rewind
- Set position indicator to the beginning (function)
Error-handling:
- clearerr
- Clear error indicators (function)
- feof
- Check End-of-File indicator (function)
- ferror
- Check error indicator (function)
- perror
- Print error message (function)
Macros
- EOF
- End-of-File (constant)
- FILENAME_MAX
- Maximum length of file names (constant)
- NULL
- Null pointer (constant)
- TMP_MAX
- Number of temporary files (constant)
cstdlib (stdlib.h)
C Standard General Utilities Library
Este cabeçalho define várias funções de uso geral, incluindo a gestão de memória dinâmica, geração de números aleatórios, a comunicação com o meio ambiente, aritiméticos inteiros, pesquisa, classificação e conversão.Functions
String conversion:- atof
- Convert string to double (function )
- atoi
- Convert string to integer (function )
- atol
- Convert string to long integer (function )
- strtod
- Convert string to double (function )
- strtol
- Convert string to long integer (function )
- strtoul
- Convert string to unsigned long integer (function )
Pseudo-random sequence generation:
- rand
- Generate random number (function)
- srand
- Initialize random number generator (functions)
Dynamic memory management:
- calloc
- Allocate space for array in memory (function)
- free
- Deallocate space in memory (function)
- malloc
- Allocate memory block (function)
- realloc
- Reallocate memory block (function)
Environment:
- abort
- Abort current process (function)
- atexit
- Set function to be executed on exit (function)
- exit
- Terminate calling process (function)
- getenv
- Get environment string (function)
- system
- Execute system command (function )
Searching and sorting:
- bsearch
- Binary search in array (function )
- qsort
- Sort elements of array (function)
Integer arithmethics:
- abs
- Absolute value (function)
- div
- Integral division (function )
- labs
- Absolute value (function)
- ldiv
- Integral division (function )
Multibyte characters:
- mblen
- Get length of multibyte character (function)
- mbtowc
- Convert multibyte character to wide character (function)
- wctomb
- Convert wide character to multibyte character (function)
Multibyte strings:
- mbstowcs
- Convert multibyte string to wide-character string (function)
- wcstombs
- Convert wide-character string to multibyte string (function)
Macros
- EXIT_FAILURE
- Failure termination code (macro)
- EXIT_SUCCESS
- Success termination code (macro)
- MB_CUR_MAX
- Maximum size of multibyte characters (macro)
- NULL
- Null pointer (macro)
- RAND_MAX
- Maximum value returned by rand (macro)
Types
- div_t
- Structure returned by div (type)
- ldiv_t
- Structure returned by div and ldiv (type)
- size_t
- Unsigned integral type (type)
Nenhum comentário:
Postar um comentário