david
21.07.2013, 12:56 |
tv_sec in sys/time.h (Developers) |
struct fd_set rfds;
memset(&rfds,0,sizeof(fd_set));
FD_ZERO(&rfds);
FD_SET(0, &rfds);
struct timeval tv;
tv.tv_sec=0;
tv.tv_usec=0;
int i=select(1,&rfds,NULL,NULL,&tv);
Hello, Can I ask You about part of code? I have #include <sys/time.h> and compiler writes err
storage size tv isn`t know, How I can right declare tv ? Thank You for any idea,
David |
bocke
21.07.2013, 18:12
@ david
|
tv_sec in sys/time.h |
> struct fd_set rfds;
> memset(&rfds,0,sizeof(fd_set));
> FD_ZERO(&rfds);
> FD_SET(0, &rfds);
> struct timeval tv;
> tv.tv_sec=0;
> tv.tv_usec=0;
> int i=select(1,&rfds,NULL,NULL,&tv);
>
> Hello, Can I ask You about part of code? I have #include <sys/time.h> and
> compiler writes err
> storage size tv isn`t know, How I can right declare tv ? Thank You for any
> idea,
>
> David
Just a quick guess, but you might try allocating the memory for the tv before its usage:
struct timeval tv;
tv = malloc (sizeof(struct timeval));
tv.tv_sec=0;
tv.tv_usec=0; |
Tito
01.08.2013, 03:23
@ david
|
tv_sec in sys/time.h |
> struct fd_set rfds;
> memset(&rfds,0,sizeof(fd_set));
> FD_ZERO(&rfds);
> FD_SET(0, &rfds);
> struct timeval tv;
> tv.tv_sec=0;
> tv.tv_usec=0;
> int i=select(1,&rfds,NULL,NULL,&tv);
>
> Hello, Can I ask You about part of code? I have #include <sys/time.h> and
> compiler writes err
> storage size tv isn`t know, How I can right declare tv ? Thank You for any
> idea,
>
> David
Not sure about memory allocation, he declared tv as a struct not struct *. |
david
12.08.2013, 14:23
@ Tito
|
tv_sec in sys/time.h |
Hi,
read_fds is declared in sys/select.h... on GNU/Linux systems, DJGPP doesn`t know select.h??
is there any header declare read_fds??
Thanks
David |