Politechnika Śląska - strona 311

note /search

Bsearch

  • Politechnika Śląska
  • Fundamentals of Computer Programming
Pobrań: 0
Wyświetleń: 504

Bsearch  The task: check, whether a value is in a sorted array  A slow solution: linear search  A fast solution: binary search  A function from stdlib: bsearch void *bsearch(const void *key, const void *base, size_t nelem, size_t width, int (*fcmp)(const void*, const void*)); ...

Creat close unlink

  • Politechnika Śląska
  • Fundamentals of Computer Programming
Pobrań: 0
Wyświetleń: 434

creat, close, unlink  open is like fopen , except that instead of returning a file pointer, it returns a file descriptor, which is just an int  open returns -1 if any error occurs int open(char *name, int flags, int perms); #include int fd; ......

Exec

  • Politechnika Śląska
  • Fundamentals of Computer Programming
Pobrań: 14
Wyświetleń: 602

exec*  int execl (char *path, char *arg0, ..., NULL);  int execle (char *path, char *arg0, ..., NULL, char **env);  int execlp (char *path, char *arg0, ...);  int execlpe(char *path, char *arg0, ..., NULL, char **env);  int execv (char *path, char *argv[]);  int execve (char *path, char *argv...

File Descriptors

  • Politechnika Śląska
  • Fundamentals of Computer Programming
Pobrań: 0
Wyświetleń: 567

File Descriptors  A file descriptor is an integer  A file descriptor is analogous to the file pointer used by the standard library  All information about an open file is maintained by the system  The user program refers to the file only by the file descriptor  Three files are open, with file d...

Fork

  • Politechnika Śląska
  • Fundamentals of Computer Programming
Pobrań: 0
Wyświetleń: 595

Fork  UNIX #include #include pid_t fork(void);  Example int fork_return; printf("Process %d about to fork a child.\n", getpid()); fork_return = fork(); if( fork_return ...

It is implemented

  • Politechnika Śląska
  • Fundamentals of Computer Programming
Pobrań: 0
Wyświetleń: 476

It is implemented, use it void qsort(void *base, size_t nelem, size_t width, int (*fcmp)(const void *, const void *));  The programmer provides a function comparing elements  Elements should be of the same size, stored in an array  They may be e.g. pointers ...

Itoa ltoa, ultoa

  • Politechnika Śląska
  • Fundamentals of Computer Programming
Pobrań: 0
Wyświetleń: 490

stdlib.h: itoa, ltoa, ultoa  itoa converts an integer to a string  ltoa converts a long to a string  ultoa converts an unsigned long to a string  Declarations: char *itoa(int value, char *string, int radix); char *ltoa(long value, char *string, int radix); char *ultoa(unsigned long value, char ...

Open

  • Politechnika Śląska
  • Fundamentals of Computer Programming
Pobrań: 0
Wyświetleń: 441

Open  As with fopen , the name argument is a character string containing the filename  The second argument, flags , is an int that specifies how the file is to be opened  The main values are: - O_RDONLY open for reading only - O_WRONLY open for writing only - O_RDWR open for both reading and wri...

Other features

  • Politechnika Śląska
  • Fundamentals of Computer Programming
Pobrań: 0
Wyświetleń: 490

Other features  Available features depend on the version of make  makedepend - a program creating dependencies in Makefiles  imake - C preprocessor interface to the make utility  used to generate Makefiles from a template, a set of cpp macro...

Other Preprocessor Commands

  • Politechnika Śląska
  • Fundamentals of Computer Programming
Pobrań: 0
Wyświetleń: 504

Other Preprocessor Commands  #error text of error message generates an appropriate compiler error message  Example #ifdef OS_MSDOS #include #elifdef OS_UNIX #include "default.h" #els...