Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import std.stdio;
- extern(Windows)
- bool SetConsoleCP(
- uint wCodePageID
- );
- extern(Windows)
- bool SetConsoleOutputCP(
- uint wCodePageID
- );
- //extern (C) bool SetConsoleCP(uint wCodePageID);
- int main(string args[])
- {
- File file;
- try
- {
- file.open("C:\\Windows\\System32\\Drivers\\etc\\hosts","r");
- }
- catch(StdioException e)
- {
- writeln(e);
- return 1;
- }
- int countLines;
- while(!file.eof())
- {
- write(file.readln());
- ++countLines;
- }
- SetConsoleCP(65001);
- SetConsoleOutputCP(65001);
- writeln("Количество строк равно: ", countLines);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement