Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6816919
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:59:03+00:00 2026-05-26T20:59:03+00:00

I have an issue with my code, and I can’t find out what the

  • 0

I have an issue with my code, and I can’t find out what the problem is as i’m new to select();
Could anyone please tell me what’s the issue from?


run_fct.c: In function ‘run’:
run_fct.c:22: error: invalid type argument of ‘->’ (have ‘fd_set’)
cc1: warnings being treated as errors
run_fct.c:11: error: unused variable ‘timeout’
make: *** [run_fct.o] Error 1

FD_SET(0, fds);

void run(t_coord* piece, t_env* env, t_used_piece* rand_piece)
{
    char            arrows[2000];
    int             number;
    int             nread;
    int             ret;
    fd_set          fds;
    struct timeval  timeout;
    int             test;

    test = 0;
    (void)env;
    number = 0;
    set_keypress();
    init_pieces(piece);
    while (1)
    {
        FD_ZERO(&fds);
        FD_SET(0, fds);
        ret = select(1, &fds, 0, 0, 0);
        if (test == 0)
        {
            get_piece(rand_piece);
            number = rand_piece->piece;
            print_piece(env, piece, number);
        }
        if (ret > 0)
        {
            if (FD_ISSET(0, &fds))
            {
                nread = read(0, arrows, 3);
                if (arrows[0] == 27 && arrows[1] == '[' && arrows[2] == 'A')
                {
                    printf("A = UP\n");
                    piece[number].ay = piece[number].ay + 1;
                }
                else if (arrows[0] == 27 && arrows[1] == '[' && arrows[2] == 'B')
                {
                    piece[number].ay = piece[number].ay + 2;
                }
                else if (arrows[0] == 27 && arrows[1] == '[' && arrows[2] == 'C')
                {
                    piece[number].ax = piece[number].ax + 1;
                    piece[number].ay = piece[number].ay + 1;
                }
                else if (arrows[0] == 27 && arrows[1] == '[' && arrows[2] == 'D')
                {
                    piece[number].ax = piece[number].ax - 1;
                    piece[number].ay = piece[number].ay + 1;
                }
                else
                {
                    piece[number].ay = piece[number].ay + 1;
                }
            }
        }
        test = 1;
    }
    reset_keypress();
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T20:59:04+00:00Added an answer on May 26, 2026 at 8:59 pm

    Perhaps you mean FD_SET(0, &fds); (you forgot the & before fds).

    And I do hope you know that using select has some limitations. ppoll, poll or pselect might be better.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a strange issue with my code I can't seem to figure out.
I have been thinking about this issue and I can't figure it out. Perhaps
I have an issue with this jquery code below. Please give me advice or
I have an issue with my C++ code for college. I can't seem to
Can anyone help, seem to have an issue placing a onclick event of an
I have an issue with my code I can get it to copy all
I have one issue that i want to ping URL from code behind (EXE
I have a code as you can see below. I am trying to find
I have an issue with php where code works on on computer but wont
I have an issue with SQLAlchemy apparently committing. A rough sketch of my code:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.