Главная страница
    Top.Mail.Ru    Яндекс.Метрика
Форум: "Начинающим";
Текущий архив: 2007.07.15;
Скачать: [xml.tar.bz2];

Вниз

текстовые файлы   Найти похожие ветки 

 
matt ©   (2007-06-19 02:51) [0]

Почему в Д7 нельзя обьявить в процедуре переменную типиа
var
 f : text;


 
Rial ©   (2007-06-19 03:34) [1]

F : TextFile;


 
ЮЮ ©   (2007-06-19 03:42) [2]

Почему нельзя?

procedure proc;
var
 f: Text;
begin
 AssignFile(f, "");
 Reset(f);
 CloseFile(f);
end;


D7 нигде не возражает


 
Ega23 ©   (2007-06-19 10:50) [3]

Можно.


 
icWasya ©   (2007-06-19 11:38) [4]

Почему в Д7 нельзя ...
Потому, что у компонент есть свойство  Text.
Специально для разрешения такого конфликта, файловый тип Text из Pascal заменён на TextFile. Так же изменены названия процедур работы с файлами - Assign заменёт на AssignFile, Close - на CloseFile.


 
Anatoly Podgoretsky ©   (2007-06-19 11:52) [5]


> icWasya ©   (19.06.07 11:38) [4]

Откуда вдруг взялся компонент, явно же написано ПРОЦЕДУРА, а не метод


 
icWasya ©   (2007-06-19 13:58) [6]

>Anatoly Podgoretsky ©   (19.06.07 11:52) [5]
А Вы уверены, что человек, не знающий ответа на [1], знает и разницу между методом и процедурой?


 
Ega23 ©   (2007-06-19 14:06) [7]


This section summarizes I/O using file variables of the standard type Text.

When a text file is opened, the external file is interpreted in a special way: It is considered to represent a sequence of characters formatted into lines, where each line is terminated by an end-of-line marker (a carriage-return character, possibly followed by a linefeed character). The type Text is distinct from the type file of Char.

For text files, there are special forms of Read and Write that let you read and write values that are not of type Char. Such values are automatically translated to and from their character representation. For example, Read(F, I), where I is a type Integer variable, reads a sequence of digits, interprets that sequence as a decimal integer, and stores it in I.

There are two standard text file variables, Input and Output. The standard file variable Input is a read-only file associated with the operating system"s standard input (typically, the keyboard). The standard file variable Output is a write-only file associated with the operating system"s standard output (typically, the display). Before an application begins executing, Input and Output are automatically opened, as if the following statements were executed:

AssignFile(Input, "");
Reset(Input);
AssignFile(Output, "");
Rewrite(Output);

Note

For Win32 applications, text-oriented I/O is available only in console applications--that is, applications compiled with the "Generate console application" option checked on the Linker page of the Project Options dialog box or with the -cc command-line compiler option. In a GUI (non-console) application, any attempt to read or write using Input or Output will produce an I/O error.

Some of the standard I/O routines that work on text files don"t need to have a file variable explicitly given as a parameter. If the file parameter is omitted, Input or Output is assumed by default, depending on whether the procedure or function is input- or output-oriented. For example, Read(X) corresponds to Read(Input, X) and Write(X) corresponds to Write(Output, X).

If you do specify a file when calling one of the input or output routines that work on text files, the file must be associated with an external file using AssignFile, and opened using Reset, Rewrite, or Append. An error occurs if you pass a file that was opened with Reset to an output-oriented procedure or function. An error also occurs if you pass a file that was opened with Rewrite or Append to an input-oriented procedure or function.


 
matt ©   (2007-06-19 14:13) [8]

спасибо!


 
Anatoly Podgoretsky ©   (2007-06-19 15:03) [9]


> А Вы уверены, что человек, не знающий ответа на [1], знает
> и разницу между методом и процедурой?

Поэтому он и оказался в начинающих, но метод у него или процедура может ответить только он, а он скромно молчит и приводит ничего не значищие кусочки кода.

Ну и так для слова - менять на TextFile не обязательно и в методе.


 
Германн ©   (2007-06-19 15:18) [10]


> Ну и так для слова - менять на TextFile не обязательно и
> в методе.

4 буквы меньше чем 6 букв + точка :)


 
Anatoly Podgoretsky ©   (2007-06-19 15:46) [11]

> Германн  (19.06.2007 15:18:10)  [10]

Э, ты меня не уговаривай использовать правильные методы, я и так согласный.



Страницы: 1 вся ветка

Форум: "Начинающим";
Текущий архив: 2007.07.15;
Скачать: [xml.tar.bz2];

Наверх





Память: 0.47 MB
Время: 0.035 c
2-1182495135
georgix
2007-06-22 10:52
2007.07.15
Заработок в Интернет, работа, как заработать, где заработать, WM


15-1181807682
rghrg
2007-06-14 11:54
2007.07.15
Факультет фотоники и оптоинформатики


2-1182228281
Officeman
2007-06-19 08:44
2007.07.15
иконка для нового типа файлов


2-1182166843
DarekS
2007-06-18 15:40
2007.07.15
Сервис и ADO


2-1182070534
a.s.popow
2007-06-17 12:55
2007.07.15
Как из текстового файла вывести две первые строки.





Afrikaans Albanian Arabic Armenian Azerbaijani Basque Belarusian Bulgarian Catalan Chinese (Simplified) Chinese (Traditional) Croatian Czech Danish Dutch English Estonian Filipino Finnish French
Galician Georgian German Greek Haitian Creole Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian
Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Thai Turkish Ukrainian Urdu Vietnamese Welsh Yiddish Bengali Bosnian
Cebuano Esperanto Gujarati Hausa Hmong Igbo Javanese Kannada Khmer Lao Latin Maori Marathi Mongolian Nepali Punjabi Somali Tamil Telugu Yoruba
Zulu
Английский Французский Немецкий Итальянский Португальский Русский Испанский