Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Meet and Greet (http://www.go4expert.com/community/meet-and-greet/)
-   -   Count Number Of Occurrences (http://www.go4expert.com/community/count-occurrences-t26596/)

DSTR3 31Aug2011 04:47

Count Number Of Occurrences
 
I'm trying to get the count of the number of times Content-Type occurs in the data[i] 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:

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;
}
}
}


Syperus 2Sep2011 12:50

Re: Count Number Of Occurrences
 
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 :)


All times are GMT +5.5. The time now is 17:49.