P
pattanawadee
Dear all,
I have a problem about compare the 2 variables by use operator
'AND' while one variable is the int constant 0x00000002 and the other
one is string '0x202'
for the constant 0x00000002 is the flag of systemcall OPEN following
fcntl.h
#define O_RDWR 0x00000002 /* open for reading and
writing */
and the string '0x202' is the variable which I got from use command
strtok cut string from output of ktruss such as I got
bufft value-->open("testprg.txt", 0x202, 0x8049bb0)
The below is my code whic use to cut string buff
char test[80], **strsysc=NULL;
char *sep = "()\",";
char *word, *brkt;
int i=0;
int aa;
strsysc=(char**)calloc(4,sizeof(char*));
printf("bufft value -->%s\n",buff);
strcpy(test,buff);
printf("test value %s\n",test);
for (word = strtok_r(test, sep, &brkt);
word;
word = strtok_r(NULL, sep, &brkt))
{
strsysc=word;
printf("word==>%s\n",strsysc);
i=i+1;
}
from code I got strsysc[2] = '0x202'
and I'd like to use 'AND' to compare it
like this if(0x00000002 & strsysc[2])
I cannot use because strsysc[2] is string and I try to use
atoi[strsysc[2]] the runtime error said Memory fault.
Please give me suggestion about this case
Regards,
Pattanawadee
I have a problem about compare the 2 variables by use operator
'AND' while one variable is the int constant 0x00000002 and the other
one is string '0x202'
for the constant 0x00000002 is the flag of systemcall OPEN following
fcntl.h
#define O_RDWR 0x00000002 /* open for reading and
writing */
and the string '0x202' is the variable which I got from use command
strtok cut string from output of ktruss such as I got
bufft value-->open("testprg.txt", 0x202, 0x8049bb0)
The below is my code whic use to cut string buff
char test[80], **strsysc=NULL;
char *sep = "()\",";
char *word, *brkt;
int i=0;
int aa;
strsysc=(char**)calloc(4,sizeof(char*));
printf("bufft value -->%s\n",buff);
strcpy(test,buff);
printf("test value %s\n",test);
for (word = strtok_r(test, sep, &brkt);
word;
word = strtok_r(NULL, sep, &brkt))
{
strsysc=word;
printf("word==>%s\n",strsysc);
i=i+1;
}
from code I got strsysc[2] = '0x202'
and I'd like to use 'AND' to compare it
like this if(0x00000002 & strsysc[2])
I cannot use because strsysc[2] is string and I try to use
atoi[strsysc[2]] the runtime error said Memory fault.
Please give me suggestion about this case
Regards,
Pattanawadee