Closed Thread
Results 1 to 3 of 3

Thread: fread into array position

  1. #1
    kenna is offline Learning Programmer
    Join Date
    Jul 2007
    Posts
    33
    Rep Power
    0

    fread into array position

    Is it possible to somehow read into a position in an array? instead of just reading into the beginning of an array.

    e.g.
    Code:
    /* read 1000 bytes into array, beginning at 0 */
    fread(array, 1, 1000, file);
    
    /* read 1000 bytes into array, beginning at pos */
    fread2(array[pos], 1, 1000, file);
    EDIT: sorry! I must be tired already knew the answer, lol
    Last edited by kenna; 08-17-2007 at 06:39 AM.

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    sea
    sea is offline Newbie
    Join Date
    Jul 2010
    Posts
    7
    Rep Power
    0

    Re: fread into array position

    Missing an ampersand there, you're going to be reading to the value in that array pos.
    Code:
            fread(array + pos,1,1000,file);
    //Alternatively
            fread(&array[pos],1,1000,file);

  4. #3
    Join Date
    Sep 2009
    Location
    USA
    Posts
    3,400
    Blog Entries
    5
    Rep Power
    37

    Re: fread into array position

    Sorry to rain on your parade, but this thread is from 2007, and the original poster already fixed his problem.
    Root Beer == System Administrator's Beer
    Download the new operating system programming kit! (some assembly required)

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 13
    Last Post: 05-04-2011, 07:14 PM
  2. caret position and id
    By davidbrook in forum Pascal and Delphi
    Replies: 1
    Last Post: 03-10-2011, 05:40 AM
  3. Chess - chili v.s. fread
    By chili5 in forum ASCII Chess
    Replies: 3
    Last Post: 05-28-2009, 12:50 PM
  4. fread and fseek don't advance buffer
    By RobotGymnast in forum C and C++
    Replies: 2
    Last Post: 10-28-2008, 03:38 PM
  5. CSS: Absolute position
    By Lop in forum JavaScript and CSS
    Replies: 8
    Last Post: 06-03-2007, 12:13 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts