Save array

This is a discussion on Save array within the C Programming forums, part of the General Programming Boards category; How to save array to a file. Thanks in advance....

  1. #1
    Registered User
    Join Date
    Sep 2004
    Posts
    13

    Save array

    How to save array to a file.
    Thanks in advance.

  2. #2
    Sweet
    Join Date
    Aug 2002
    Location
    Tucson, Arizona
    Posts
    1,801
    Same way as a non array type.
    Last edited by prog-bman; 02-23-2005 at 10:08 PM.
    Woop?

  3. #3
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    To expand slightly:
    a) Loop through the array, saving each element:
    Code:
    for( x = 0; x < numelements; x++ )
        ...save this element, your method of choice, many choices...
    b) Save the whole thing at once. (Binary files only. No arrays of pointers.)
    Code:
    fwrite( arrayname, sizeof( oneelement ), numelements, outputfile );
    c) Think up some other fun way on your own.

    Quzah.
    Hope is the first step on the road to disappointment.

  4. #4
    Registered User xxxrugby's Avatar
    Join Date
    Jan 2005
    Posts
    178
    I think that the best way is too went on this page and look!


    All you can do with printing into file! And how to! with examples!
    Sorry for spelling errors, not English!
    xxxrugby: "All Human Race Will Die From My Hand!"
    xxxrugby: "We are all philosophers, when question is about politics!"

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 1
    Last Post: 03-19-2009, 10:56 AM
  2. Replies: 2
    Last Post: 07-11-2008, 07:39 AM
  3. question about multidimensional arrays
    By richdb in forum C Programming
    Replies: 22
    Last Post: 02-26-2006, 08:51 AM
  4. [question]Analyzing data in a two-dimensional array
    By burbose in forum C Programming
    Replies: 2
    Last Post: 06-13-2005, 07:31 AM
  5. Class Template Trouble
    By pliang in forum C++ Programming
    Replies: 4
    Last Post: 04-21-2005, 04:15 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21