.


:




:

































 

 

 

 





++ , . , C. ++ C , ++ , C.

. , , / .

++ : , ++ , , - , .

; , , , . - , .

, . , , , - - , , memset setmem.

++, 1989 , ++ , . , . Turbo C Borland Microsoft C: , , , .

, , , , , , , . , , , . , Turbo C Microsoft C .

- , , . , . , : , (), ( ), , , .

- . : - . :

0 1 2EOF

EOF .

/ , , /, . . .

, (, , .), ANSI , . , , .

: (text) (binary).

. , , . , , , .

, , .

. , .

. , 5- 10- . , , . : , .

. . , . , .

, , , FILE. stdio.h.

5 . : stdin , stdout , stderr . ( , +). , , . / , Windows, DOS, UNIX, OS/2.

C++

++ , _withassign iostream.h :

extern istream_withassign cin; extern ostream_withassign cout; extern ostream_withassign cerr; extern ostream_withassign clog;

iostream.h, .

.

:

cin - ;

cout - ;

cerr - ;

clog - .

. 11.1 -.

11.1

-

ios
istream ,
ifstream
istream with assign cin
istrstream
ostream ,
ofstream
ostream_withassign cout, cerr, and clog
ostrstream
-
iostream -, -
fstream -
sir stream -
stdiostream - -
Streambuf
filebuf
s trs treambuf
stdiobuf -

. _withassign . , .

- C++ - .

.

pthread_create

poa exec , , (initial thread). pthread_create:

#include <pthread.h> int pthread_create(pthread_t * tid, const pthread_attr_t *attr, void *(*func) (void *), void *arg); /* 0 , */  

 

, pthread_t. tid.

: , , . . pthread_attr_t, , . . attr .

, , , (thread start function). ( pthread_exit), ( ). func, arg. , .

Posix 0 . , 1 errno , Pthread . , pthread_create - oae , EAGAIN. Pthread errno. , (<sys/errno.h>).

pthread_join

pthread_join - - . Unix, , pthread_create fork, a pthread_join waitpid:

#include <pthread.h> int pthread_join(pthread_t tid, void **status); /* 0 , */  

, ( waitpid 1 ).

status , ( ) , status.

pthread_self

, . pthread_create pthread_join. pthread_self:

#include <pthread.h> pthread_t pthread_self(void); /* */ pthread_self getpid Unix.    

 

pthread_detach

( ), . , - pthread_join. -. . . , .

pthread_detach :

#include <pthread.h> int pthread_detach(pthread_t tid); /* 0 , */    

 

pthread_detach(pthread_self());

pthread_exit

pthread_exit:

#include <pthread.h> void pthread_exit(void *status); /* */

 

, , pthread_join.

status ( ), .

: 1) ( pthread_create) return. void, ; 2) main exit _exit. , .

:

) :

1) .. . . 1988.

2).. . ++. .,2001.

) :

3). . C/C++ . : 2012.

4) . . - ++. : 2013. : -.

5.) ., .. : . . .: , 2014. 908 .: .

6) . C++: . . .: , 2013. 699

7) . - C++.

8) .., .. ++: - . I. ++. - : , 2012. - 490 .

9) ++. . . , . . , . . , . .

10) .., .. C++. . - .: (), 2015. - 48 .

.





:


: 2016-12-06; !; : 1157 |


:

:

, .
==> ...

1704 - | 1576 -


© 2015-2024 lektsii.org - -

: 0.035 .