1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

Count Number Of Occurrences

Discussion in 'Meet and Greet' started by DSTR3, Aug 31, 2011.

  1. DSTR3

    DSTR3 New Member

    Joined:
    Aug 31, 2011
    Messages:
    1
    Likes Received:
    1
    Trophy Points:
    0
    I'm trying to get the count of the number of times Content-Type occurs in the data where I stated. I'm new at this and I can't seem to fingd something that's simple enough. Any suggestions are welcome.

    Code:
    [FONT=Courier New]void printRawData(unsigned char *data, int length, int more)
    {
    int i, c=0;
    printf(" -------------IP Data Begins-------------\n");
    for (i=0; i<length; i++)
    {
    if ((data[i]>30 && data[i]<122) || 
    (((data[i]==10) || (data[i]==13) || (data[i]==123) || (data[i]==125))
    && (more>0)))
    {
    printf("%c", data[i]);
    //////////////////////////////////////////////////////
    ////CODE HERE/////////////////////
    ////////////////////////////////////////////////////
    c+=1;
    }
    else
    {
    printf("[%i]", data[i]);
    c+=3;
    if (data[i]>9) c++;
    if (data[i]>99) c++;
    }
    if (c>=47)
    {
    printf("\n");
    c=0;
    }
    }
    }[/FONT]
     
    Muthukumaran likes this.
  2. Syperus

    Syperus New Member

    Joined:
    Sep 2, 2011
    Messages:
    45
    Likes Received:
    9
    Trophy Points:
    0
    Location:
    127.0.0.1
    I know I'm new to the forums, but I think your question would be best answered in the Programming > C-C++ section. Having said that..I'll take a look at your problem when I'm more sober :)
     

Share This Page