Getting input from file


#1

How do i read file line by line as integer

suppose,
there is file
file.txt

1
2
3
4
5

and i want to read it as int vector or and arrya how do i do this.


#2

The rust cookbook has examples for these sorts of “common” problems. In particular, you probably want to combine this recipe on reading lines in a file with str::parse().