Thread: Dual Scripted Array to hold chars

  1. #1
    Registered User
    Join Date
    Nov 2002
    Posts
    14

    Dual Scripted Array to hold chars

    char AdapterList[10][1024]

    How do i write chars into this array..

    so later i can
    easily reference them via
    just there array script later?

    eg.below

    While (i <=10)
    {
    printf("%d%,AdapterList[i]);
    i++;
    }

    and this should print the character stored at this subscript
    until it reaches the null character

  2. #2
    Registered User
    Join Date
    Nov 2002
    Posts
    14
    the datatypes i want to store in the array
    have to be unicode chars

    so use whatever datatypes u want..
    i was told TCHAR but

    couldnt get it to work

  3. #3
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826

    Re: Dual Scripted Array to hold chars

    Originally posted by GUI_XP
    char AdapterList[10][1024]

    How do i write chars into this array..

    so later i can
    easily reference them via
    just there array script later?

    eg.below

    While (i <=10)
    {
    printf("%d%,AdapterList[i]);
    i++;
    }

    and this should print the character stored at this subscript
    until it reaches the null character
    You can assign them in numerous ways. If you're doing one at a time, you just:

    array[x][y] = some_char;

    If you're using each "row" as a string, you could use strncpy. Since you require non-char types (unicode) you'll have to probably assign them manually, and you'll want an array of integers probably.

    To display a string, you don't use %d. You use %s.

    Search the board for some of the newbie posts on how to use multidimensional arrays to get you started.

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

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Rand function for array of chars
    By JFonseka in forum C Programming
    Replies: 7
    Last Post: 02-24-2008, 02:55 PM
  2. Getting a 2 byte number from an array of char's
    By kzar in forum C Programming
    Replies: 20
    Last Post: 04-10-2005, 10:18 PM
  3. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 09:54 AM
  4. Hi, could someone help me with arrays?
    By goodn in forum C Programming
    Replies: 20
    Last Post: 10-18-2001, 09:48 AM
  5. passing char where array of chars required
    By larry in forum C++ Programming
    Replies: 4
    Last Post: 09-25-2001, 01:24 PM