Reading multiple integers from the same line without string manipulation

Hi all! I’m relatively new to Julia. I’m wondering if there is a way to read a line of integers like this in a file without using readline(s) and then parsing and manipulating the resulting string. The text file I want to read from will look something like this:

1 2 3 4\n
5 6 7 8\n

I want to be able to put 1, 2, 3, 4 into an array and 5, 6, 7, 8 into an array. How can I accomplish this? I have code for using readline and then parsing the string, it’s just annoying and tedious.

Thanks in advance.

Numbers as part of a text are not stored the way a number in memory is stored. The process of converting from one representation (text) to the other (memory) is called parsing. You won’t get around doing this on way or another.

If all of your textfiles look like this, you can use CSV.jl (setting the seperator to a space character) or the DelimitedFiles standard library function readdlm (again, setting the seperator to a space character).