Thread: Zero out two dimensional array

  1. #16
    Registered User
    Join Date
    Jan 2009
    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:

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

  2. #17
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    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.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

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, 01:01 AM
  4. Replies: 5
    Last Post: 11-20-2001, 12:48 PM