public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* [FEEDBACK] Issue with fd_set, FD_ZERO, FD_SET, FD_SETSIZE : Cygwin
@ 2023-02-06 20:25 Yeo Kai Wei
  2023-02-06 20:30 ` gs-cygwin.com
  2023-02-06 20:31 ` Eliot Moss
  0 siblings, 2 replies; 25+ messages in thread
From: Yeo Kai Wei @ 2023-02-06 20:25 UTC (permalink / raw)
  To: cygwin

[-- Attachment #1: Type: text/plain, Size: 2125 bytes --]

Hi,

I would like to report an issue with Cygwin 3.4.2 on Windows.

It doesn't seem to be able to work with  fd_set, FD_ZERO, FD_SET, 
FD_SETSIZE macros.

The code is in italics. The filename was selectStdIn.c. The terminal 
command used was "gcc -o selectStdIn selectStdIn.c"

Thank you.

/
/

/CODE
/

/#include <stdio.h>//
//#include <stdlib.h>//
//#include <sys/time.h>//
//#include <unistd.h>//
/ /
//void main()//
//{//
//    fd_set fds; //set of file descriptors//
/ /
//    struct timeval tv;//
/ /
//    int flag;//
/ /
//    char byte;//
/ /
//    FD_ZERO(&fds);//
/ /
//    FD_SET(0, &fds);//
/ /
//    tv.tv_sec = 5;//
/ /
//    tv.tv_usec = 0;//
/ /
//    flag = select(FD_SETSIZE, //
//            &fds,//
//            NULL,//
//            NULL,//
//            &tv);//
/ /
//    if(-1 == flag)//
//        perror("select error");//
//    else if(flag)//
//    {//
//        read(0,&byte,1);//
/ /
//        puts("data read");//
//    }//
/ /
//    if(flag)//
//        printf("The byte value is %c\n", byte);//
////
//}/


TERMINAL COMMANDS

$ gcc -o selectStdIn selectStdIn.c
selectStdIn.c: In function 'main':
selectStdIn.c:8:2: error: unknown type name 'fd_set'; did you mean 'fpos_t'?
   fd_set fds; //set of file descriptors
   ^~~~~~
   fpos_t
selectStdIn.c:16:2: warning: implicit declaration of function 'FD_ZERO' 
[-Wimpli
cit-function-declaration]
   FD_ZERO(&fds);
   ^~~~~~~
selectStdIn.c:18:2: warning: implicit declaration of function 'FD_SET' 
[-Wimplic
it-function-declaration]
   FD_SET(0, &fds);
   ^~~~~~
selectStdIn.c:24:9: warning: implicit declaration of function 'select'; 
did you
mean 'sleep'? [-Wimplicit-function-declaration]
   flag = select(FD_SETSIZE,
          ^~~~~~
          sleep
selectStdIn.c:24:16: error: 'FD_SETSIZE' undeclared (first use in this 
function)
   flag = select(FD_SETSIZE,
                 ^~~~~~~~~~
selectStdIn.c:24:16: note: each undeclared identifier is reported only 
once for
each function it appears in



^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2023-02-07  8:43 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-06 20:25 [FEEDBACK] Issue with fd_set, FD_ZERO, FD_SET, FD_SETSIZE : Cygwin Yeo Kai Wei
2023-02-06 20:30 ` gs-cygwin.com
2023-02-06 20:33   ` Yeo Kai Wei
2023-02-06 20:59     ` gs-cygwin.com
2023-02-06 22:50       ` Yeo Kai Wei
2023-02-06 23:03       ` Yeo Kai Wei
2023-02-06 23:19         ` gs-cygwin.com
2023-02-06 23:27         ` Eliot Moss
2023-02-06 23:48           ` Yeo Kai Wei
2023-02-06 23:50             ` Eliot Moss
2023-02-06 23:53               ` Yeo Kai Wei
     [not found]               ` <PH0PR05MB9918F39B0B689DFF52980D11A4DB9@PH0PR05MB9918.namprd05.prod.outlook.com>
2023-02-07  1:53                 ` Eliot Moss
2023-02-07  0:34           ` Yeo Kai Wei
2023-02-07  1:54             ` Eliot Moss
2023-02-07  3:15               ` Yeo Kai Wei
2023-02-07  3:56               ` Yeo Kai Wei
2023-02-07  4:44                 ` Eliot Moss
2023-02-07  4:28               ` Yeo Kai Wei
2023-02-07  4:46                 ` Eliot Moss
2023-02-07  5:21                   ` Yeo Kai Wei
2023-02-07  5:51                     ` Eliot Moss
2023-02-07  5:53                 ` Brian Inglis
2023-02-07  6:59                   ` Yeo Kai Wei
2023-02-07  8:43                     ` Hans-Bernhard Bröker
2023-02-06 20:31 ` Eliot Moss

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).