Folks...a very frustrating problem........pls. help.
I am reading a input file having special characters like
^L^F^H^I^K^M ...... and so on, among other data.
I am reading the input file using fread.
char *buf ;
Allocate memeory for buf ;
fread(buf,1,LEN,fp);
/* I come to know about the value of LEN just before fread
LEN gives me the number of special characters on current line
in the input file */
Point to be noted each '^L','^F'..... are being stored as 'single'
characters in 'buf'.
After these characters I go on and read other data from the input
file and process it.
In the program I have to convert the special characters to their
decimal values.Their decimal values are given in the ASCII table.
I first tired used 'atoi' which obviously didn't work !!!.
Now I have declared a static multidimensional char. array.
A sample :
static char *table[2][33] = {
{"^@", "^A","^B","^C","^D",..............} ,
{ "1" , "2" ,"3", "4", "5", ................. }
};
My problem is I cannot even use 'strcmp' to compare. 'strcmp'
just fails and dumps core .
Because spl. chars. read from input file as being read/stored as
single characters and my array treats each spl. char as strings.
How do i get the decimal equivalent of such characters in this
case. I am working on SOLARIS platform.
Any ideas ....???
I am really stuck and have no idea how to do it .
Appreciate all kinds of suggestions.
Thanks.