Can there be an empty string in the middle of the file as well and not just at the end? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can there be an empty string in the middle of the file as well and not just at the end?

3rd Sep 2016, 10:40 AM
Sambit Dam
Sambit Dam - avatar
1 Answer
+ 1
It's unclear what you mean by empty string in a file. Technically, a file is a byte array, it doesn't have any strings inside. String is an abstraction that comes in play if you work with a file in text mode. Do you mean, if you read text file line by line, can a read string be empty and not be the last in file? The answer is no, because it has to contain at least newline to be not the last, but it's empty.
3rd Sep 2016, 1:57 PM
trueneu
trueneu - avatar