You open the file in the correct way. To read the integer, do read(f, Int32) followed by read(f, Float64, 1_000_000) to read the million floats. See the manual at http://docs.julialang.org/en/release-0.5/stdlib/io-network/
On Tue, Oct 25, 2016 at 10:05 PM, Aleksandr Mikheev <al.mikhee...@gmail.com> wrote: > Hello, sorry if this question have already been asked, but I could not > find a similar thread. So, I have a .dat ("numbers.dat") file, which I > should open. I believe I should do something like this: > > f = open("numbers.dat") > > > And after that I tried to read it: > > readlines(f) > > > However, Julia writes the Error: "UnicodeError: invalid character index". > My tutor told me that this is a binary file, so what I need is a binary > read, such as fread in C/C++. I tried to read the documentation, tried > to google, but still cannot understand what should I do. Also, a quote from > my tutor, which can probably help you to understand the problem better: "The > first 4 bytes contain an integer (in this case, 1,000,000) and then > 1,000,000 floats of 8 bytes each". > > Thank you in advance! >