Read a file line by line: Difference between revisions
Content added Content deleted
(Add Ruby solution) |
m (Spacing between languages) |
||
Line 12: | Line 12: | ||
}</lang> |
}</lang> |
||
The File is managed by reference count, and it gets closed when it gets out of scope or it changes. The 'line' is a char[] (with newline), so if you need a string you have to idup it. |
The File is managed by reference count, and it gets closed when it gets out of scope or it changes. The 'line' is a char[] (with newline), so if you need a string you have to idup it. |
||
=={{header|Python}}== |
=={{header|Python}}== |
||
For the simple case of iterating over the lines of a file you can do: |
For the simple case of iterating over the lines of a file you can do: |