currently studying redirection in my C book and was wondering if its possible to use redirection to read a binary file. I tried to read an excel file for example and i just got a bunch of weird characters and spacees. Any ideas why?
currently studying redirection in my C book and was wondering if its possible to use redirection to read a binary file. I tried to read an excel file for example and i just got a bunch of weird characters and spacees. Any ideas why?
Warning: Opinions subject to change without notice
The C Library Reference Guide
Understand the fundamentals
Then have some more fun
How exactly did you try to read the excel file? Do you know the file format they use to store data in the excel file? (I know I don't...)
Also, in order to read binary files, you need to use fread.
>> Any ideas why?
Because it's binary.
Binary files contain bytes which aren't necessarily printable.
gg
Think about it...If i write to a file with a stucture declared asand you read it with something like a character array, what do you think you'll get. Meaningless garbage(basically) You need to read with that same type of struct to get what you want.Code:struct info{ int x; short y; char *width; double z; long long cat; };
>>>to linuxdude.
Which you never know cause it could be anything. I guess thats makes sense.
in regards to how i read the file
from the command line, in the same directory where the files are:
read < vocab.txt
where read is a .exe in C to read each character unitl EOF and vocab is a text document.
Warning: Opinions subject to change without notice
The C Library Reference Guide
Understand the fundamentals
Then have some more fun
Thanks for the link.Originally Posted by Dave_Sinkula
Warning: Opinions subject to change without notice
The C Library Reference Guide
Understand the fundamentals
Then have some more fun