Results 1 to 2 of 2

Thread: Read from file into array (C)

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2001
    Posts
    117

    Question Read from file into array (C)

    Can anybody help me, in c:

    How do i read data from a file, eg. numbers
    and use them to populate an array?

    Since i dont the the amount of data, how do i define the array?

    Thanx

  2. #2
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    You'd need some kind of dynamically expanding array. In C++ you'd use a vector, but in C you have to work slightly harder and do it yourself.

    This is a bit of cheap code I did a while ago that might be useful
    Attached Files Attached Files
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

Posting Permissions

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



Click Here to Expand Forum to Full Width