Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to index page
Thread view  Board view
david(R)

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(R)

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(R)

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(R)

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

Back to index page
Thread view  Board view
15186 Postings in 1365 Threads, 250 registered users, 17 users online (0 registered, 17 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum