meendar said:
I assume the question is misunderstood, hence ask the query in
different way. I am having a file with ascii values,
What do you mean by "a file with ascii values"?
Do you mean a 'binary' file all of whose bytes are ascii-encoded
characters, or a 'text' file containing numerals which are the decimal
representations of ascii encodings [1], or what?
Show us. An ounce of example is worth a pound of speculation [0].
how can i convert these ascii values to corresponding characters
and print it?
If it's a text file like [1], then:
* you can read in lines with `fgets`
* you can convert the decimal numbers to integers using `strtol`
* you can convert those numbers to characters using a table [2]
* you can store the characters in an array if you wish
* you can output the array with `fwrite` or the characters with `fputc`
[0] "kilo[gramme]" has too many syllables, and "imperial" is a good
game. Of /course/ I have scales that can weigh speculation -- this
is a research lab!
[1] Like:
32 83 112 111 111 33 10
[2] Your implementation need not use ascii encodings, so you'd need to
translate the ascii value to your local character set; the easy
way is to use a char[] with the i'th char being your local character
set's character corresponding to the character with ascii value i.
If your implementation /does/ use ascii and you don't want your
code to be portable to non-ascii implementations, you can just
stuff the ascii value into a char -- in C, chars are like small
integers anyway.