Buchempfehlung
Windows-Programmierung. Das Entwicklerhandbuch zur WIN32-API
Windows-Programmierung. Das Entwicklerhandbuch zur WIN32-API
"Der" Petzold, das über 1000 Seiten starke Standardwerk zum Win32-API - besonders nützlich u. a. bei der GUI-Programmierung in FreeBASIC! [Mehr Infos...]
FreeBASIC-Chat
Es sind Benutzer im FreeBASIC-Chat online.
(Stand:  )
FreeBASIC bei Twitter
Twitter FreeBASIC-Nachrichten jetzt auch über Twitter erhalten. Follow us!


Referenz - Funktionen der CRT

Referenz-Navigation

 

Funktionen der C Standard Library

FreeBASIC erlaubt das Einbinden der Funktionen der Standard C Bibliothek. Hier eine alphabetische Aufstellung, sowie eine gruppierte nach ihrer Funnktionalität.

Beschreibung:
Die Kommentar-Spalte enthält eine kurze Beschreibung der Funktion. Die Liste ist nicht vollständig, gibt aber einen guten Überblick über die meisten Funktionen der C Runtime Library. Die angegebenen Funktionen werden sicher von FreeBASIC unterstützt. Für weitere Informationen siehe z.B. Externer Link!diese Referenz.

Hinweis: Die folgenden Deklarationen sind nicht die offiziell in FreeBASIC enthaltenen, sie sollten aber genügend Informationen geben, um die Funktionen anwenden zu können.

Die Datei-Spalte beinhaltet den Namen der Datei, die eingebunden werden muss. Dies geschieht mit dem Befehl BefehlsreferenzeintragINCLUDE am Anfang des Programmcodes. Sollte die angegebene Datei nicht eingebunden werden, wird das Programm entweder nicht compilieren, oder normal compilieren, aber danach falsche Werte ausgeben. Alle Header der C Runtime befinden sich im Unterordner crt. So muss, um etwa die math.bi einzubinden, #include "crt/math.bi" bzw. #include "crt/math.bi" angegeben werden. Alternativ kann man mit #include "crt.bi" alle Dateien einbinden.

Die Deklaration-Spalte enthalten folgende Informationen:

So bedeutet z.B. atoi(a as zstring ptr) as integer, dass die Funktion atoi einen Wert vom Typ integer zurückgibt und einen zstring ptr als Parameter benötigt.


Alphabetische Liste

Name Deklaration (mit Parametern) Datei Kommentar
abs_ abs_(n as integer) as integer stdlib.bi Gibt den Absolutwert zurück (also den positiven Wert)
acos_ acos_(a as double) as double math.bi Gibt den Arkuscosinus zurück (Winkel in Radianten)
asin_ asin_(a as double) as double math.bi Gibt den Arkussinus zurück (Winkel in Radianten)
atan_ atan_(a as double) as double math.bi Gibt den Arkustangens zurück (Winkel in Radianten)
atan2_ atan2_(y as double, x as double) as double math.bi Gibt den Arkustangens zurück (Ankathete als x, Gegenkathete als y)
atoi atoi(s as zstring ptr) as integer stdlib.bi Konvertiert einen ZString mit Ziffern in eine Ganzzahl (Integer).
atof atof(s as zstring ptr) as double stdlib.bi Konvertiert einen ZString mit Ziffern in eine Gleitkommazahl (Double).
calloc calloc(NumElts as integer, EltSiz as integer) as any ptr stdlib.bi Fordert Speicher an. Gibt einen Pointer auf einen Puffer zurück, der Platz für ein Array bestehend aus NumElts Elementen der Größe EltSiz Bytes bietet.
ceil ceil(d as double) as double math.bi Rundet auf die nächsthöhere Ganzzahl.
clearerr clearerr(s as FILE ptr) stdio.bi Setzt den Error-Indikator eines Filestreams (lesen oder schreiben) zurück.
cos_ cos_(ar as double) as double math.bi Gibt den Cosinus eines Winkels in Radianten zurück.
cosh cosh(x as double) as double math.bi Gibt den Cosinus Hyperbolicus eines Winkels in Radianten zurück.
div div(num as integer, denom as integer) as div_t stdlib.bi Gibt den Quotienten und Rest einer Division als Struktur div_t zurück.
ecvt ecvt(x as double) as zstring ptr math.bi Konvertiert eine Zahl in einen ZString.
exit_ exit_(status as integer) stdlib.bi Beendet das Programm. Dabei werden alle Dateipuffer geleert, offene Dateien geschlossen und von atexit() aufgerufene Funktionen ausgeführt.
exp_ exp_(a as double) as double math.bi Gibt den Wert von e hoch a zurück (Umkehrfunktion des natürlichen Logarithmus).
fabs fabs(d as double) as double math.bi Gibt den Absolutwert (d.h. den positiven Wert) einer Double-Zahl zurück.
fclose fclose(s as FILE ptr) as FILE ptr stdio.bi Schließt eine Datei. Gibt bei Erfolg 0 zurück, andernfalls EOF.
feof feof(s as FILE ptr) as integer stdio.bi Gibt den Wert des Dateiende-Indikators zurück. Dieser hat den Wert 0, solange das Dateiende noch nicht erreicht wurde. Der Indikator setzt sich automatisch zurück, aber kann auch manuell mittels clearerr() zurückgesetzt werden.
ferror ferror(s as FILE ptr) as integer stdio.bi Gibt die Fehlernummer für einen Stream zurück (0 wenn kein Fehler aufgetreten ist). Die Fehlernummer wird durch clearerr() oder rewind() zurückgesetzt.
fflush fflush(s as FILE ptr) as integer stdio.bi Leert (z. B. löscht) einen Stream (verwenden Sie stdin, um den Stream der Tastatur zu leeren). Gibt bei Erfolg 0 zurück.
fgetc fgetc(s as FILE ptr) as integer stdio.bi Einzelnes eingelesenes Zeichen (als ASCII-Code) vom übergebenen Stream (stdin zum Lesen von der Tastatur).
fgetpos fgetpos(s as FILE ptr, c as fpos_t ptr) as integer stdio.bi Speichert die Position des Dateizeigers von Stream s an der Stelle, auf die der Pointer c zeigt.
fgets fgets(b as zstring ptr, n as integer, s as FILE ptr) as zstring ptr stdio.bi Liest bis zu n-1 Zeichen von Stream s in den Buffer b.
floor floor(d as double) as double math.bi Gibt die größte ganze Zahl zurück, die kleiner oder gleich d ist. (Abrunden der Zahl d)
fmod fmod(x as double, y as double) as double math.bi Errechnet den Rest der Division x / y.
fopen fopen(file as zstring ptr, mode as zstring ptr) as FILE ptr stdio.bi Öffnet eine Datei. Übergeben wird der DOS-Dateiname und eine Modus-Zeichenkette. Gültige Werte für letztere sind r (read) für lesenden Zugriff, w (write) für schreibenden Zugriff, a (append) für schreibenden Zugriff am Dateiende und r+ (Datei muss existieren) bzw. w+ (Datei wird neu angelegt) für lesenden und schreibenden Zugriff. Zusätzlich kann ein angehängtes b die Verwendung des Binärmodus signalisieren.
fprintf fprintf(s as FILE ptr, fmt as zstring ptr, ...) as integer stdio.bi Prints on stream s as many items as there are single % signs in fmt that have matching arguments in the list.
fputc fputc(c as integer, s as FILE ptr) as integer stdio.bi Gibt ein einzelnes Zeichen c in den Stream s aus.
fputs fputs(b as zstring ptr, s as FILE ptr) as integer stdio.bi Sends the character stream in b to stream s, returns 0 if the operation fails.
fread fread(buf as any ptr, b as size_t, c as size_t, s as FILE ptr) as integer stdio.bi Liest c Daten-Elemente der Größe von b Bytes aus der Datei s in den Buffer buf. Gibt die Anzahl der Elemente an, die tatsächlich gelesen wurden.
free free(p as any ptr) stdlib.bi Gibt den für einen Zeiger p angeforderten Speicher zur anderwertigen Verwendung wieder frei.
freopen freopen(file as zstring ptr, mode as zstring ptr, s as FILE ptr) as FILE ptr stdio.bi Öffnet eine Datei, um einen Stream umzuleiten. Z. B. freopen("myfile", "w", stdout) öffnet die Datei "myfile" und leitet die Standardausgabe dorthin um.
frexp frexp(x as double, p as integer ptr) as double math.bi Berechnet den Wert m so, dass x = m * 2 ^ exponent. p ist ein Pointer auf m; exponent ist der Rückgabewert der Funktion.
fscanf fscanf(s as FILE ptr, fmt as zstring ptr, ...) as integer stdio.bi Reads from stream s as many items as there are % signs in fmt with corresponding listed pointers.
fseek fseek(s as FILE ptr, offset as integer, origin as integer) as integer stdio.bi Locates a file pointer. With origin 0, 1 or 2 for the beginning, offset bytes into and at the end of the stream.
fsetpos fsetpos(s as FILE ptr, p as fpos_t ptr) as integer stdio.bi Sets the file pointer for the stream s to the value pointed to by p.
ftell ftell(s as FILE ptr) as long stdio.bi Locates the position of the file pointer for the stream s.
fwrite fwrite(buf as any ptr, b as integer, c as integer, s as FILE ptr) as integer stdio.bi Writes the number c items of data of size b bytes from the buffer buf to the file s. Returns the number of data items actually written.
getc getc(s as FILE ptr) as integer stdio.bi Macro for single character input (in ASCII) from passed stream. (stdin for keyboard)
getchar getchar() as integer stdio.bi Liest ein einzelnes Zeichen von der Standardeingabe ein
gets gets(b as zstring ptr) as zstring ptr stdio.bi Reads a stream of characters from the standard input until it meets \n or EOF.
hypot hypot(x as double, y as double) as double math.bi Errechnet die Hypotenuse aus den Katheten x und y.
isalnum isalnum(c as integer) as integer ctype.bi Gibt einen Wert ungleich 0 zurück, wenn es sich beim Zeichen c um einen Buchstaben oder eine Ziffer handelt.
isalpha isalpha(c as integer) as integer ctype.bi Gibt einen Wert ungleich 0 zurück, wenn es sich beim Zeichen c um einen Buchstaben handelt.
iscntrl iscntrl(c as integer) as integer ctype.bi Gibt einen Wert ungleich 0 zurück, wenn es sich beim Zeichen c um ein Steuerzeichen handelt.
isdigit isdigit(c as integer) as integer ctype.bi Gibt einen Wert ungleich 0 zurück, wenn es sich beim Zeichen c um eine Ziffer handelt.
isgraph isgraph(c as integer) as integer ctype.bi Gibt einen Wert ungleich 0 zurück, wenn es sich beim Zeichen c um ein darstellbares Zeichen handelt.
islower islower(c as integer) as integer ctype.bi Gibt einen Wert ungleich 0 zurück, wenn es sich beim Zeichen c um einen Kleinbuchstaben handelt.
isprint isprint(c as integer) as integer ctype.bi Gibt einen Wert ungleich 0 zurück, wenn es sich beim Zeichen c um ein druckbares Zeichen handelt.
ispunct ispunct(c as integer) as integer ctype.bi Gibt einen Wert ungleich 0 zurück, wenn es sich beim Zeichen c um ein Satzzeichen handelt.
isspace isspace(c as integer) as integer ctype.bi Gibt einen Wert ungleich 0 zurück, wenn es sich beim Zeichen c um ein Leerzeichen handelt.
isupper isupper(c as integer) as integer ctype.bi Gibt einen Wert ungleich 0 zurück, wenn es sich beim Zeichen c um einen Großbuchstaben handelt.
isxdigit isxdigit(c as integer) as integer ctype.bi Gibt einen Wert ungleich 0 zurück, wenn es sich beim Zeichen c um eine Hex-Ziffer handelt (0 bis F oder f).
ldexp ldexp(x as double, n as integer) as double math.bi Gibt das Produkt von x und 2 hoch n zurück.
ldiv ldiv(num as long, denom as long) as ldiv_t stdlib.bi Gibt Quotient und Rest einer Division als Struktur ldiv_t zurück.
log_ log_(a as double) as double math.bi Gibt den natürlichen Logarithmus des Parameterwerts zurück.
log10 log10(a as double) as double math.bi Gibt den Zehnerlogarithmus des Parameterswerts zurück.
malloc malloc(bytes as integer) as any ptr stdlib.bi Allocates memory. Returns a pointer to a buffer comprising storage for the specified size.
modf modf(d as double, p as double ptr) as double math.bi Gibt den Nachkommateil einer Gleitkommazahl d zurück. nt number d. Der Zeiger p zeigt auf den Ganzzahligen Anteil als Float
perror perror(mess as zstring ptr) stdio.bi Prints on the stream stderr a message passed as the argument.
pow pow(x as double, y as double) as double math.bi Returns x to the power y.
pow10 pow10(x as double) as double math.bi Returns 10 to the power x (inverse function to log10()).
printf printf(fmt as zstring ptr, ...) as integer stdio.bi Prints on standard output as many items as there are single % signs in fmt with matching arguments in the list.
putc putc(c as integer, s as FILE ptr) as integer stdio.bi Macro to output the single character c to the stream s.
putchar putchar(c as integer) as integer stdio.bi Macro to output the single character c to the standard output.
puts puts(b as zstring ptr) as integer stdio.bi Sends the character stream in b to the standard output, returns 0 if operation fails.
rand rand() as integer stdlib.bi Returns a pseudo random number. A seed is required. The seed is set with srand.
realloc realloc(p as any ptr, newsize as size_t) as any ptr stdlib.bi Allocates memory. Returns a pointer to a buffer for a change in size of object pointed to by p.
rewind rewind(s as FILE ptr) stdio.bi Clears the error indicators on a file stream (read or write). Necessary before reading an amended file.
scanf scanf(fmt as zstring ptr, …) as integer stdio.bi Reads from standard input as many items as there are % signs in fmt with corresponding listed pointers.
sin_ sin_(ar as double) as double math.bi Gibt den Sinus eines Winkels in Radianten zurück.
sinh sinh(x as double) as double math.bi Gibt den Sinus Hyperbolicus eines Winkels in Radianten zurück.
sprintf sprintf(p as zstring ptr, fmt as zstring ptr, ...) as integer stdio.bi Prints on zstring p as many items as there are single % signs in fmt that have matching arguments in the list.
sqrt sqrt(a as double) as double math.bi Gibt die Quadratwurzel des Parameterwerts zurück. Bei einem negativen Wert unter der Wurzel wird ein Domain error ausgelöst.
srand srand(seed as uinteger) stdlib.bi Sets the seed for a random number. A possible seed is the current time.
sscanf sscanf(b as zstring ptr, fmt as zstring ptr, ...) as integer stdio.bi Reads from buffer b as many items as there are % signs in fmt with corresponding listed pointers.
strcat strcat(s1 as zstring ptr, s2 as zstring ptr) as zstring ptr string.bi Concatenates (appends) zstring s2 to s1.
strchr strchr(s as zstring ptr, c as integer) as zstring ptr string.bi Returns a pointer to the first occurrence of c in s or NULL if it fails to find one.
strcmp strcmp(s1 as zstring ptr, s2 as zstring ptr) as integer string.bi Compares zstring s2 to s1. Returns 0 or signed difference in ASCII values of first non matching character.
strcpy strcpy(s1 as zstring ptr, s2 as zstring ptr) as zstring ptr string.bi Copies s2 into s1.
strcspn strcspn(s1 as zstring ptr, s2 as zstring ptr) as integer string.bi Gibt die Zeichenanzahl von s1 zurück, bis zu welcher kein Zeichen aus s2 vorkommt.
strerror strerror(n as integer) as zstring ptr string.bi Returns a pointer to a system error message corresponding to the passed error number.
strlen strlen(s as zstring ptr) as integer string.bi Gibt die Länge eines Null-terminierten Strings in Bytes zurück (ohne Null mitzuzählen).
strncat strncat(s1 as zstring ptr, s2 as zstring ptr, n as integer) as zstring ptr string.bi Concatenates (appends) n bytes from zstring s2 to s1.
strncmp strncmp(s1 as zstring ptr, s2 as any ptr, n as integer) as integer string.bi Compares n bytes of zstring s2 to the same of s1. Returns 0 or signed difference in ASCII values of first non matching character.
strncpy strncpy(s1 as zstring ptr, s2 as zstring ptr, n as integer) as zstring ptr string.bi Copies n bytes from s2 into s1.
strpbrk strpbrk(s1 as zstring ptr, s2 as zstring ptr) as zstring ptr string.bi Returns a pointer to the first character encountered in s1 that is also in s2.
strrchr strrchr(s as zstring ptr, c as integer) as zstring ptr string.bi Returns a pointer to the last occurrence of c in s or NULL if it fails to find one.
strspn strspn(s1 as zstring ptr, s2 as zstring ptr) as integer string.bi Gibt die Zeichenanzahl von s1 zurück, bis zu welcher kein nicht in s2 vorhandenes Zeichen vorkommt.
strstr strstr(s1 as zstring ptr, s2 as zstring ptr) as zstring ptr string.bi Finds the location of the zstring s2 in s1 and returns a pointer to its leading character.
strtod strtod(s as zstring ptr, p as zstring ptr) as double stdlib.bi Converts a zstring to double, provided the zstring is written in the form of a number.
strtok strtok(s1 as zstring ptr, s2 as zstring ptr) as zstring ptr string.bi Returns pointers to successive tokens utilizing the zstring s1. Tokens regarded as separators are listed in s2.
System System(command as zstring ptr) as integer stdlib.bi Executes, from within a program, a command addressed to the operating system written as a zstring (e.g. DIR on Windows and DOS and LS on Linux).
tan_ tan_(ar as double) as double math.bi Gibt den Tangens eines Winkels in Radianten zurück.
tanh tanh(x as double) as double math.bi Gibt den Tangens Hyperbolicus eines Winkels in Radianten zurück.
tolower tolower(c as integer) as integer ctype.bi Converts a character from upper case to lower case (uses ASCII code).
toupper toupper(c as integer) as integer ctype.bi Converts a character from lower case to upper case (uses ASCII code).
ungetc ungetc(c as integer, s as FILE ptr) as integer stdio.bi Pushes a character c back into the stream s, returns EOF if unsuccessful. Do not push more than one character.

Puffermanipulation

#include "crt/string.bi"

Deklaration (mit Parametern) Kommentar
memchr(s as any ptr, c as integer, n as size_t) as any ptr Search for a character in a buffer.
memcmp(s1 as any ptr, s2 as any ptr, n as size_t) as integer Compare two buffers.
memcpy(dest as any ptr, src as any ptr, n as size_t) as any ptr Copy one buffer into another .
memmove(dest as any ptr, src as any ptr, n as size_t) as any ptr Move a number of bytes from one buffer lo another.
memset(s as any ptr, c as integer, n as size_t) as any ptr Set all bytes of a buffer to a given character.

Zeichenklassifizierung - konvertierung

#include "crt/ctype.bi"

Deklaration (mit Parametern) Kommentar
isalnum(c as integer) as integer TRUE if c is alphanumeric.
isalpha(c as integer) as integer TRUE if c is a letter.
isascii(c as integer) as integer TRUE if c is ASCII .
iscntrl(c as integer) as integer TRUE if c is a control character.
isdigit(c as integer) as integer TRUE if c is a decimal digit.
isgraph(c as integer) as integer TRUE if c is a graphical character.
islower(c as integer) as integer TRUE if c is a lowercase letter.
isprint(c as integer) as integer TRUE if c is a printable character.
ispunct(c as integer) as integer TRUE if c is a punctuation character.
isspace(c as integer) as integer TRUE if c is a space character.
isupper(c as integer) as integer TRUE if c is an uppercase letter.
isxdigit(c as integer) as integer TRUE if c is a hexadecimal digit.
toascii(c as integer) as integer Convert c to ASCII .
tolower(c as integer) as integer Convert c to lowercase.
toupper(c as integer) as integer Convert c to uppercase.

Datenkonvertierung

#include "crt/stdlib.bi"

Deklaration (mit Parametern) Kommentar
atof(string1 as zstring ptr) as double Convert zstring to floating point value.
atoi(string1 as zstring ptr) as integer Convert zstring to an integer value.
atol(string1 as zstring ptr) as integer Convert zstring to a long integer value.
itoa(value as integer, zstring as zstring ptr, radix as integer) as zstring ptr Convert an integer value to a zstring using given radix.
ltoa(value as long, zstring as zstring ptr, radix as integer) as zstring ptr Convert long integer to zstring in a given radix.
strtod(string1 as zstring ptr, endptr as zstring ptr) as double Convert zstring to a floating point value.
strtol(string1 as zstring ptr, endptr as zstring ptr, radix as integer) as long Convert zstring to a long integer using a given radix.
strtoul(string1 as zstring ptr, endptr as zstring ptr, radix as integer) as ulong Convert zstring to unsigned long.

Pfadmanipulation

#include "crt/io.bi"

Deklaration (mit Parametern) Kommentar
_chdir(path as zstring ptr) as integer Change current directory to given path.
_getcwd(path as zstring ptr, numchars as integer) as zstring ptr Returns name of current working directory.
_mkdir(path as zstring ptr) as integer Create a directory using given path name.
_rmdir(path as zstring ptr) as integer Delete a specified directory.

Dateimanipulation

#include "crt/sys/stat.bi"

#include "crt/io.bi"

Deklaration (mit Parametern) Kommentar
chmod(path as zstring ptr, pmode as integer) as integer Change permission settings of a file.
fstat(handle as integer, buffer as type stat ptr) as integer Get file status information.
remove(path as zstring ptr) as integer Delete a named file.
rename_(oldname as zstring ptr, newname as zstring ptr) as integer rename a file.
stat(path as zstring ptr, buffer as type stat ptr) as integer Get file status information of named file.
umask(pmode as uinteger) as uinteger Set file permission mask.

Stream I/O

#include "crt/stdio.bi"

Deklaration (mit Parametern) Kommentar
clearerr(file_pointer as FILE ptr) Clear error indicator of stream,
fclose(file_pointer as FILE ptr) as integer Close a file,
feof(file_pointer as FILE ptr) as integer Check if end of file occurred on a stream.
ferror(file_pointer as FILE ptr) as integer Check if any error occurred during file I/0.
fflush(file_pointer as FILE ptr) as integer Write out (flush) buffer to file.
fgetc(file_pointer as FILE ptr) as integer Get a character from a stream.
fgetpos(file_pointer as FILE ptr, fpos_t current_pos) as integer Get the current position in a stream.
fgets(string1 as zstring ptr, maxchar as integer, file_pointer as FILE ptr) as zstring ptr Read a zstring from a file.
fopen(filename as zstring ptr, access_mode as zstring ptr) as FILE ptr Open a file for buffered I/0.
fprintf(file_pointer as FILE ptr, format_string as zstring ptr, args) as integer Write formatted output to a file,
fputc(c as integer, file_pointer as FILE ptr) as integer Write a character to a stream.
fputchar(c as integer) as integer Write a character to stdout.
fputs(string1 as zstring ptr, file_pointer as FILE ptr) as integer Write a zstring to a stream.
fread(buffer as zstring ptr, size as size_t count as size_t, file_pointer as FILE ptr) as size_t Read unformatted data from a stream into a buffer.
freopen(filename as zstring ptr, access as zstring ptr mode, file_pointer as FILE ptr) as FILE ptr Reassign a file pointer to a different file.
fscanf(file_pointer as FILE ptr, format as zstring ptr zstring, args) as integer Read formatted input from a stream.
fseek(file_pointer as FILE ptr, offset as long, origin as integer) as integer Set current position in file to a new location.
fsetpos(file_pointer as FILE ptr, current_pos as fpos_t) as integer Set current position in file to a new location.
ftell(file_pointer as FILE ptr) as long Get current location in file.
fwrite(buffer as zstring ptr, size as size_t, count as size_t file_pointer as FILE ptr) as size_t Write unformatted data from a buffer to a stream.
getc(file_pointer as FILE ptr) as integer Read a character from a stream.
getchar() as integer Read a character from stdin.
gets(buffer as zstring ptr) as zstring ptr Read a line from stdin into a buffer.
printf(format as zstring ptr _string, args) as integer Write formatted output to stdout.
putc(c as integer, file_pointer as FILE ptr) as integer Write a character to a stream.
putchar(c as integer) as integer Write a character to stdout.
puts(string1 as zstring ptr) as integer Write a zstring to stdout.
rewind(file_pointer as FILE ptr) Rewind a file.
scanf(format_string as zstring ptr, args) as integer Read formatted input from stdin.
setbuf(file_pointer as FILE ptr, buffer as zstring ptr) Set up a new buffer for the stream.
setvbuf(file_pointer as FILE ptr, buffer as zstring ptr, buf_type as integer, buf as size_t size) as integer Set up new buffer and control the level of buffering on a stream.
sprintf(string1 as zstring ptr, format_string as zstring ptr, args) as integer Write formatted output to a zstring.
sscanf(buffer as zstring ptr, format_string as zstring ptr, args) as integer Read formatted input from a zstring.
tmpfile() as FILE ptr Open a temporary file.
tmpnam(file_name as zstring ptr) as zstring ptr Get temporary file name.
ungetc(c as integer, file_pointer as FILE ptr) as integer Push back character into stream' s buffer

Low level I/O

#include "crt/io.bi"

Nur für Windows, da für die anderen Plattformen bis jetzt die Header fehlen.

Deklaration (mit Parametern) Kommentar
_close(handle as integer) as integer Close a file opened for unbuffered I/O.
_creat(filename as zstring ptr, pmode as integer) as integer Create a new file with specified permission setting.
_eof(handle as integer) as integer Check for end of file.
_lseek(handle as integer, offset as long, origin as integer) as long Go to a specific position in a file.
_open(filename as zstring ptr, oflag as integer, pmode as uinteger) as integer Open a file for low-level I/O.
_read(handle as integer, buffer as zstring ptr, length as uinteger) as integer Read binary data from a file into a buffer.
_write(handle as integer, buffer as zstring ptr, count as uinteger) as integer Write binary data from a buffer to a file.

Mathematik

#include "crt/math.bi"

Deklaration (mit Parametern) Kommentar
abs_(n as integer) as integer Get absolute value of an integer.
acos_(x as double) as double Compute arc cosine of x.
asin_(x as double) as double Compute arc sine of x.
atan_(x as double) as double Compute arc tangent of x.
atan2_(y as double, x as double) as double Compute arc tangent of y/x.
ceil(x as double) as double Get smallest integral value that exceeds x.
cos_(x as double) as double Compute cosine of angle in radians.
cosh(x as double) as double Compute the hyperbolic cosine of x.
div(number as integer, denom as integer) as div_t Divide one integer by another.
exp_(x as double) as double Compute exponential of x.
fabs(x as double) as double Compute absolute value of x.
floor(x as double) as double Get largest integral value less than x.
fmod(x as double, y as double) as double Divide x by y with integral quotient and return remainder.
frexp(x as double, expptr as integer ptr) as double Breaks down x into mantissa and exponent of no.
labs(n as long) as long Find absolute value of long integer n.
ldexp(x as double, exp as integer) as double Reconstructs x out of mantissa and exponent of two.
ldiv(number as long, denom as long) as ldiv_t Divide one long integer by another.
log_(x as double) as double Compute log(x).
log10(x as double) as double Compute log to the base 10 of x.
modf(x as double, intptr as double ptr) as double Breaks x into fractional and integer parts.
pow(x as double, y as double) as double Compute x raised to the power y.
rand() as integer Get a random integer between 0 and 32.
Random(max_num as integer) as integer Get a random integer between 0 and max_num.
Randomize() Set a random seed for the random number generator.
sin_(x as double) as double Compute sine of angle in radians.
sinh(x as double) as double Compute the hyperbolic sine of x.
sqrt(x as double) as double Compute the square root of x.
srand(seed as uinteger) Set a new seed for the random number generator (rand).
tan_(x as double) as double Compute tangent of angle in radians.
tanh(x as double) as double Compute the hyperbolic tangent of x.

Speicherallokation

#include "crt/stdlib.bi"

Deklaration (mit Parametern) Kommentar
calloc(num as size_t elems, elem_size as size_t) as any ptr Allocate an array and initialise all elements to zero .
free(mem_address as any ptr) Free a block of memory.
malloc(num as size_t bytes) as any ptr Allocate a block of memory.
realloc(mem_address as any ptr, newsize as size_t) as any ptr ReAllocate (adjust size) a block of memory.

Prozesskontrolle

#include "crt/stdlib.bi"

Deklaration (mit Parametern) Kommentar
abort() Abort a process.
execl(path as zstring ptr, arg0 as zstring ptr, arg1 as zstring ptr,..., NULL) as integer Launch a child process (pass command line).
execlp(path as zstring ptr, arg0 as zstring ptr, arg1 as zstring ptr,..., NULL) as integer Launch child (use PATH, pass command line).
execv(path as zstring ptr, argv as zstring ptr) as integer Launch child (pass argument vector).
execvp(path as zstring ptr, argv as zstring ptr) as integer Launch child (use PATH, pass argument vector).
exit_(status as integer) Terminate process after flushing all buffers.
getenv(varname as zstring ptr) as zstring ptr Get definition of environment variable,
perror(string1 as zstring ptr) Print error message corresponding to last system error.
putenv(envstring as zstring ptr) as integer Insert new definition into environment table.
raise(signum as integer) as integer Generate a C signal (exception).
system_(string1 as zstring ptr) as integer Execute a resident operating system command.

Suchen und Sortieren

#include "crt/stdlib.bi"

Hinweis: Die compare Callback-Funktion, die von bsearch und qsort benötigt wird, muss mit BefehlsreferenzeintragCDECL deklariert werden. Sie muss kleiner 0 sein, wenn der Wert des ersten Parameters der Funktion vor dem, des zweiten in der Sortierung liegt und größer 0, wenn der erste Wert hinter dem zweiten liegt. Die Funktion muss 0 zurückgeben, wenn beide Werte gleich sind.

Deklaration (mit Parametern) Kommentar
bsearch(key as any ptr, base as any ptr, num as size_t, width as size_t, compare as function(elem1 as any ptr, elem2 as any ptr) as integer) as any ptr Perform binary search.
qsort(base as any ptr, num as size_t, width as size_t, compare as function(elem1 as any ptr, elem2 as any ptr) as integer) Use the quicksort algorithm to sort an array.

Stringmanipulation

#include "crt/string.bi"

Deklaration (mit Parametern) Kommentar
stpcpy(dest as zstring ptr, src as zstring ptr) as zstring ptr Copy one zstring into another.
strcmp(string1 as zstring ptr, string2 as zstring ptr) as integer Compare string1 and string2 to determine alphabetic order.
strcpy(string1 as zstring ptr, string2 as zstring ptr) as zstring ptr Copy string2 to string1.
strerror(errnum as integer) as zstring ptr Get error message corresponding to specified error number.
strlen(string1 as zstring ptr) as integer Determine the length of a zstring.
strncat(string1 as zstring ptr, string2 as zstring ptr, n as size_t) as zstring ptr Append n characters from string2 to string1.
strncmp(string1 as zstring ptr, string2 as zstring ptr, n as size_t) as integer Compare first n characters of two strings.
strncpy(string1 as zstring ptr, string2 as zstring ptr, n as size_t) as zstring ptr Copy first n characters of string2 to string1.
strnset(string1 as zstring ptr, c as integer, size _t n) as zstring ptr Set first n characters of zstring to c.
strrchr(string1 as zstring ptr, c as integer) as zstring ptr Find last occurrence of character c in zstring.

Zeit

#include "crt/time.bi"

Deklaration (mit Parametern) Kommentar
asctime(time as type tm ptr) as zstring ptr Convert time from type tm to zstring.
clock() as clock_t Get elapsed processor time in clock ticks.
ctime(time as time_t ptr) as zstring ptr Convert binary time to zstring.
difftime(time_t time2, time_t time1) as double Compute the difference between two times in seconds.
gmtime(time as time_t ptr) as type tm ptr Get Greenwich Mean Time (GMT) in a tm structure.
localtime(time as time_t ptr) as type tm ptr Get the local time in a tm structure.
time_(timeptr as time_t ptr) as time_t Get current time as seconds elapsed since 0 hours GMT 1/1/70.

Siehe auch:


Zusätzliche Informationen und Funktionen
  • Der Referenzeintrag wurde am 29.12.2010 von RedakteurMOD angelegt.
  • Die aktuellste Version wurde am 29.12.2010 von Redakteurnemored gespeichert.
  Versionen Versionen