scan multiple items in multidimensional array

This is a discussion on scan multiple items in multidimensional array within the C Programming forums, part of the General Programming Boards category; I am having trouble scanning multiple items into an array. I am trying to scan anywhere up to 10 items ...

  1. #1
    Registered User
    Join Date
    Apr 2003
    Posts
    10

    scan multiple items in multidimensional array

    I am having trouble scanning multiple items into an array. I am trying to scan anywhere up to 10 items into a multidimensionalarray. The data is then written to a text file seperated by commas. If there are not 10 items commas are placed anyway.

    so I have something like
    char info[10][50];
    declared

    and I need help figuring out how to scan the items, so a user can stop entering in info at anytime. I know how to write files to text files, but I need a way to write it like this

    say the 3 words scooby, dooby, + doo are entered
    i need the text file to show this:
    scooby,dooby,doo,,,,,,,,
    Any help would be much appreciated

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    You will probably want something like fscanf.

    Loop until the return value of fscanf is not one, (IE: Until there are no words), or until you reach 10 (the max number of times you wanted to read.

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

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Creating a Spreadsheet using a multidimensional array
    By Apiatan in forum C++ Programming
    Replies: 1
    Last Post: 03-21-2009, 04:18 PM
  2. help with multidimensional array
    By keira in forum C++ Programming
    Replies: 4
    Last Post: 10-30-2008, 11:28 AM
  3. multidimensional array question
    By Mr_Jack in forum C++ Programming
    Replies: 10
    Last Post: 11-01-2003, 04:54 AM
  4. Writing multiple values to an array
    By Unregistered in forum C Programming
    Replies: 1
    Last Post: 03-06-2002, 02:27 PM
  5. Searching for multiple items in an array
    By Unregistered in forum C++ Programming
    Replies: 3
    Last Post: 12-04-2001, 02:26 PM

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