Threads In C Language

Discussion in 'Green Room' started by Feedo, May 31, 2003.

  1. Feedo

    Feedo Guest

    Hi,
    Anyone has an idea about how to read or write a file in using a thread under the unix environment?


    Thanx
     
  2. X-Istence

    X-Istence * Political User

    Messages:
    6,498
    Location:
    USA
    You mean you want to fork() a program so it runs the in the background?
     
  3. X-Istence

    X-Istence * Political User

    Messages:
    6,498
    Location:
    USA
  4. Feedo

    Feedo Guest

    Thanx a lot, this seems very useful, however i'm trying to use the command Read(..,..,..) after opening a file. I want to know how to read the opened file!!
     
  5. X-Istence

    X-Istence * Political User

    Messages:
    6,498
    Location:
    USA
    Its in that same tutorial as well.

    /* read one block of 120 characters from the file stream, into 'buf'. */
    /* (the third parameter to fread() is the number of blocks to read). */
    char buf[120];
    if (fread(buf, 120, 1, f_read) != 1) {
    perror("fread");
    }