I am reading the first character from a file as a char, but it is an integer. I am using fgetc, to read it in, and now i want to get the that char i read, and assign it a new name, but not as a char, but as an integer.
Thanks
Printable View
I am reading the first character from a file as a char, but it is an integer. I am using fgetc, to read it in, and now i want to get the that char i read, and assign it a new name, but not as a char, but as an integer.
Thanks
fgetc returns an integer. However, the value is going to not be 1 if you in fact read a '1' from the file. Do something like:
x = fgetc( fp );
x = x - '0';
Quzah.
thanks!!!!! I got it to work!