I have a file of the following type:
text1.txt
1
text2.txt
20
how do I make it such that it will read the 'text.txt' as 'text' and the numbers as integers.
andrew
Printable View
I have a file of the following type:
text1.txt
1
text2.txt
20
how do I make it such that it will read the 'text.txt' as 'text' and the numbers as integers.
andrew
You have to read each line as a string. However, once you've loaded it, then you can use functions like atoi to convert them to an integer.