Ruby - reading and writing the "EOF" character
I came across a document I need for parsing that contains the old MS-DOS EOF symbol (see http://en.wikipedia.org/wiki/Substitute_character ). The problem is that Ruby doesn't read this character. However, I need to read the string containing that character and write it unchanged.
I guess writing a character shouldn't be too difficult since I know ASCII code, the main problem is that Ruby just stops reading the file after it encounters that character.
I am using something like the following code:
lineNumber = 0
File.foreach(sourcePath) do |li|
lineNumber = lineNumber + 1
end
puts lineNumber
+3
source to share
No one has answered this question yet
Check out similar questions: