colobot-data/help/R/cbot/readln.txt

21 lines
1004 B
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

\b;Инструкция \c;readln\n;
Читает одну строку из файла. это метод класса \c;\l;file\u cbot\file;\n;. Это причина, почему мы всегда пишем \c;handle.readln()\n;¦:
\c;
\s; s = handle.readln();
\n;
Файл должен быть октрыть на чтение (\c;"r"\n;) с помощью инструкции \c;\l;open\u cbot\open;\n;. \c;readln\n; возвращает строку, содержащую линию, но юез символа конца линии 0x0D (CR) и 0x0A (LF).
Синтаксис¦:
\s;\c;string = handle.readln ( );\n;
Пример¦:
\c;
\s; string s;
\s; s = handle.readln();
\s; if ( s == "abc" )
\s; ...
\n;
\t;См. также
\c;\l;file\u cbot\file;\n;, \c;\l;open\u cbot\open;\n;, \c;\l;close\u cbot\close;\n;, \c;\l;writeln\u cbot\writeln;\n; and \c;\l;eof\u cbot\eof;\n;.
\l;Программирование\u cbot;, \l;типы\u cbot\type; и \l;категории\u cbot\category;.