Incomplete words read from file
pascal111
judas.the.messiah.111 at gmail.com
Wed Nov 17 23:46:15 UTC 2021
I made small program that shows the content of textual files, and
it succeeded to show non-English (Ascii code) language, but in
many lines some words are not complete and their rests are in
next lines, how can fix it?
"https://i.postimg.cc/rpP7dQYH/Screenshot-from-2021-11-18-01-40-43.png"
'''d
// D programming language
import std.stdio;
import std.string;
int main()
{
string s;
char[] f;
try{
write("Enter file name and path: ");
readln(f);
f=strip(f);}
catch(Exception err){
stderr.writefln!"Warning! %s"(err.msg);}
File file = File(f, "r");
while (!file.eof()) {
s = chomp(file.readln());
writeln(s);
}
file.close();
return 0;
}
'''
More information about the Digitalmars-d-learn
mailing list