invalid types `unsigned char[int]' for array subscript

Discussion in 'C++' started by uche, Feb 26, 2007.

  1. uche

    uche Guest

    Please give me some feed back on this issue:


    Here is the complier error:
    hexdmp.cpp: In function `void output(unsigned char, int, bool&)':
    hexdmp.cpp:133: error: invalid types `unsigned char[int]' for array
    subscript
    hexdmp.cpp:146: error: invalid types `unsigned char[int]' for array
    subscript
    hexdmp.cpp:146: error: invalid types `unsigned char[int]' for array
    subscript
    hexdmp.cpp:149: error: invalid types `unsigned char[int]' for array
    subscript


    Here is the code:

    while (!endoffile)
    {
    cout<<setw(4)<<setfill('0')<<uppercase<<hex<<addr<<"0: ";
    for (int index = 0; index <16; index++)
    {
    index2++;
    if (index2 <= curr_buffer_size)
    cout<<hex<<setw(2)<<setfill('0')<<(int)ret_buffer[index];
    else
    cout<<" ";
    cout<<" ";
    }//end for
    cout<<setfill(' ');
    //cout<< " ");
    index2 = 0;
    for (int index = 0; index < 16; index ++)
    {
    index2++;
    if (index2 <= index)
    {
    if (ret_buffer[index] < 32 || ret_buffer[index] > 126)
    printf('.');
    else
    cout<<ret_buffer[index];
    }//end if
    }//end for
     
    uche, Feb 26, 2007
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Timo Freiberger
    Replies:
    3
    Views:
    952
    Bob Hairgrove
    Oct 30, 2004
  2. Hal Styli
    Replies:
    14
    Views:
    1,646
    Old Wolf
    Jan 20, 2004
  3. uche
    Replies:
    3
    Views:
    2,397
    gangs
    Feb 26, 2007
  4. Gabriel Genellina
    Replies:
    0
    Views:
    515
    Gabriel Genellina
    Aug 13, 2009
  5. pozz
    Replies:
    12
    Views:
    744
    Tim Rentsch
    Mar 20, 2011
Loading...

Share This Page