Zero out two dimensional array

This is a discussion on Zero out two dimensional array within the C Programming forums, part of the General Programming Boards category; This is from Bluetooth Specification: "a friendly host name can be up to 248 bytes in length, hence the response ...

  1. #16
    Registered User
    Join Date
    Jan 2009
    Posts
    61
    This is from Bluetooth Specification: "a friendly host name can be up to 248 bytes in length, hence the response packet will be in excess of this value"

    sorry for not enumerating this fact earlier

    --edit, FYI the fucntion cuts of the 248th byte if it exists, replacing it with a null character

    this is a modified if statement:

    Code:
    if(q == 248 && resp[q+9] != 0x00){
    host_fname[y][q-1] = resp[q+9];
    host_fname[y][q] = 0x00;
    break;
    }
    Last edited by davo666; 01-08-2009 at 04:30 AM. Reason: to make you think im not so bad at C

  2. #17
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,401
    In that case give the magic number a name so that it is easily seen to be the maximum length of a friendly host name.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 07-11-2008, 07:39 AM
  2. two dimensional array
    By leisiminger in forum C Programming
    Replies: 12
    Last Post: 03-09-2008, 11:53 PM
  3. Type and nontype parameters w/overloading
    By Mr_LJ in forum C++ Programming
    Replies: 3
    Last Post: 01-02-2004, 12:01 AM
  4. Replies: 5
    Last Post: 11-20-2001, 11:48 AM

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