Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2007.07.15;
Скачать: CL | DM;

Вниз

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

 
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;
Скачать: CL | DM;

Наверх




Память: 0.49 MB
Время: 0.013 c
2-1182532885
7D7
2007-06-22 21:21
2007.07.15
Фильтрация в DBGrid


2-1182266516
AlexanderMS
2007-06-19 19:21
2007.07.15
Сохранение настроек программы в её исполняемом файле.


15-1182106605
Yanis
2007-06-17 22:56
2007.07.15
Информационная система.


15-1181812261
Sir John
2007-06-14 13:11
2007.07.15
Срочно нужен толковый флэшер


8-1161848705
Lebedev
2006-10-26 11:45
2007.07.15
Графика и видео в приложении.