Thread: char arrays

  1. #1
    Unregistered
    Guest

    char arrays

    i need to read in a char array and check each character for validity as a dos filename. my problem is loading the array, accessing each element, then moving on to the next line of data.

  2. #2
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,380
    I'm not quite sure what you mean. But I'll give it a try. You can create an array of filenames:

    Code:
    char filenames [NR_OF_FILENAMES][FILENAME_LEN];
    Load the array with strcpy:

    Code:
    strcpy (filename [index], just_a_filename);
    And traverse to the array with:

    Code:
    for (index = 0; index < NR_OF_FILENAMES; index++)
        do something with filename [index]
    If my interpretation of your question is incorrect, please give some more information.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Obtaining source & destination IP,details of ICMP Header & each of field of it ???
    By cromologic in forum Networking/Device Communication
    Replies: 1
    Last Post: 04-29-2006, 02:49 PM
  2. Half-life SDK, where are the constants?
    By bennyandthejets in forum Game Programming
    Replies: 29
    Last Post: 08-25-2003, 11:58 AM
  3. comparing fields in a text file
    By darfader in forum C Programming
    Replies: 9
    Last Post: 08-22-2003, 08:21 AM
  4. String sorthing, file opening and saving.
    By j0hnb in forum C Programming
    Replies: 9
    Last Post: 01-23-2003, 01:18 AM