Sep 1, 2011 at 8:15pm
I'm trying to run a MAP to see if any of these strings are in the data[i] part.
It should return either a 1 or a 0.
This is what I have so far.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
#include <stdio.h>
#include <iostream>
#include <map>
using namespace std;
void printRawData(unsigned char *data, int length, int more)
{
int i, c=0;
printf(" -------------IP Data Begins-------------\n");
for (i=0; i<length;> {
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]);
c+=1;
//////////////////////////////////////////////////////
map<int,> mymap;
int c;
mymap [1] = "audio/basic";
mymap [2] = "audio/x-aiff";
mymap [3] = "audio/x-wav";
mymap [4] = "video/mpeg";
mymap [5] = "video/mpeg-2";
mymap [6] = "video/quicktime";
for (c=1; c<6; c++)
{
cout << c;
if (mymap.count(c)>0)
cout << "Found A Match!\n";
else
cout << "No Match Is Found.\n";
}
return;
////////////////////////////////////////////////////
//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;
}
}
}
|
Last edited on Sep 1, 2011 at 8:15pm
Sep 1, 2011 at 8:47pm
A map won't help you. You'll have to search for each of the strings in data.
Sep 1, 2011 at 9:20pm
I think I'm beging to understand, but being new would you be able to expand a little on this? Thank You.
Sep 1, 2011 at 9:34pm
I've made it as simple as it can be so even a beginner can understand what it does. If I expand, it'll become more complicated.