Re: [julia-users] Binary read

2016-10-25 Thread Michele Zaffalon
The three read commands are reading the first, the second and the third element of the file (and interpret them as Int32). That the values are in general different should not be a surprise. Yes, after you finish reading the file, you should close it: f = open("numbers.dat") anInt = read(f, Int32)

Re: [julia-users] Binary read

2016-10-25 Thread Aleksandr Mikheev
Thank you very much, Michele! One more question, if you do not mind. If I do something like this: f = open("numbers.dat") a = read(f, Int32) a = read(f, Int32) a = read(f, Int32) then a is different each time. I believe I read something about that you should use command close() each you op

Re: [julia-users] Binary read

2016-10-25 Thread Michele Zaffalon
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 wrote: > Hello, sorry

Re: [julia-users] Binary read

2016-10-25 Thread Yichao Yu
On Tue, Oct 25, 2016 at 4:05 PM, Aleksandr Mikheev 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") > > > A

[julia-users] Binary read

2016-10-25 Thread Aleksandr Mikheev
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 write