hi
i got in this way
DIR *dd;
dd = opendir("/root/ramesh/");
.....
then now i have problem
how can i convert a string to hexadecimals
ex: ram/es:h
show me the way
thank you for your feedback
ramesh
hi
i got in this way
DIR *dd;
dd = opendir("/root/ramesh/");
.....
then now i have problem
how can i convert a string to hexadecimals
ex: ram/es:h
show me the way
thank you for your feedback
ramesh
printf("%x", <character>) converts individual characters
char *a="ram/es:h"
char *p=a;
for( ; *p; p++)
printf("%2x", (int)*p);
printf("\n");
thank you jim
it is great.
your is working fine
but in that i would like to convert only symbols.
not text.
sorry for trouble you.
Ex:
char *name="rames:h/"
i want to store it as "rames3ah2f"
can you show me the way
thank you for your feedback
ramesh
If I take your meaning correctly:
{
char buf[512];
sprintf(buf,"%s%x","rames",0x3ah2f);
}
I think he wants punctuation converted to hex:
#include <ctype.h>
int main()
{
char *a="rames:h/";
char *p=a;
for (; *p; p++)
printf(ispunct(*p)?"%2x":"%c",(int)*p);
printf("\n");
return 0;
}