Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <limits.h>
- #include <string.h>
- #include <ctype.h>
- #include <unistd.h>
- #include <sys/wait.h>
- int main( void )
- {
- FILE *stream;
- char buffer[LINE_MAX];
- int run;
- int empty( char* );
- if( (stream = fopen( "channel","r+" ) ) )
- {
- run=1;
- }
- else
- {
- run=0;
- perror( "!.!..błąd otwarcia łącza..!.!" );
- }
- printf("%s\n", "Ile liczb pierwszych chcesz?");
- int N;
- scanf("%d",&N);
- printf("%s %d %s\n", "Wybrales ",N," liczb losowych.");
- fprintf(stream, "%d\n", N);
- fflush(stream);
- sleep(1);
- while( run )
- {
- if( fgets( buffer,256,stream ) )
- {
- //int* pierwsze[N];
- //sscanf(buffer,"%d\n",);
- printf("%s\t%s\n",":: FROM SERVER:",buffer);
- fflush( stream );
- }
- }
- return 0;
- }
- int empty( char * string )
- {
- while( *string )
- {
- if( isalnum(*string++) )
- {
- return 0;
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement