Вниз
Скачать: CL | DM;

Создать файл и наполнить его символами   Найти похожие ветки 

← →
IntruderLab   (2007-12-11 14:36) [0]

Добрый день! Задача вроде бы не тривиальная, необходимо создать файл, и наполнить его символами, как это сделать?


← →
Джо ©   (2007-12-11 14:38) [1]

> как это сделать?

1. Создать (открыть файл).
2. Записать туда символы.
3. Закрыть файл.

Какой вопрос, такой и...


← →
ZLinX   (2007-12-11 14:39) [2]

создаеш обьект класса TFileStream.

в методе Create передаеш имя файла и параметры создания

Write используеш для записи


← →
Palladin ©   (2007-12-11 14:39) [3]


> IntruderLab   (11.12.07 14:36) 

ну а затруднения то в чем? функций работы с файлами не знаешь чтоли?
AssignFile, Reset/Rewrite, Read/Write, CloseFile
ну или, что еще проще, использовать TFileStream


← →
DiamondShark ©   (2007-12-11 14:40) [4]

Задача как раз тривиальная: запустить индекс справки, и напечатать: "file". Потом буквально по первой же ссылке найти примерно такую страничку:

Procedure or function
Description
Append Opens an existing text file for appending.
AssignFile Assigns the name of an external file to a file variable.
BlockRead Reads one or more records from an untyped file.
BlockWrite Writes one or more records into an untyped file.
ChDir Changes the current directory.
CloseFile Closes an open file.
Eof Returns the end-of-file status of a file.
Eoln Returns the end-of-line status of a text file.
Erase Erases an external file.
FilePos Returns the current file position of a typed or untyped file.
FileSize Returns the current size of a file; not used for text files.
Flush Flushes the buffer of an output text file.
GetDir Returns the current directory of a specified drive.
IOResult Returns an integer value that is the status of the last I/O function performed.
MkDir Creates a subdirectory.
Read Reads one or more values from a file into one or more variables.
Readln Does what Read does and then skips to beginning of next line in the text file.
Rename Renames an external file.
Reset Opens an existing file.
Rewrite Creates and opens a new file.
RmDir Removes an empty subdirectory.
Seek Moves the current position of a typed or untyped file to a specified component. Not used with text files.
SeekEof Returns the end-of-file status of a text file.
SeekEoln Returns the end-of-line status of a text file.
SetTextBuf Assigns an I/O buffer to a text file.
Truncate Truncates a typed or untyped file at the current file position.
Write Writes one or more values to a file.
Writeln Does the same as Write, and then writes an end-of-line marker to the text file.


← →
{RASkov} ©   (2007-12-11 14:45) [5]

> Создать файл и наполнить его символами


> [2] ZLinX   (11.12.07 14:39)
> создаеш обьект класса TFileStream.
>
> в методе Create передаеш имя файла и параметры создания
>
> Write используеш для записи


Как всё сложно :)


← →
altatr ©   (2007-12-12 15:58) [6]

Форма с одной кнопкой

procedure TForm1.Button1Click(Sender: TObject);
var
  f: TextFile;
begin
  AssignFile(f, "текст.txt"); // открываем файл
  Append(f);
  writeln(f, "№/"@&77%^ghfr%^&$%)_+0=0908%");  // добавляем символы
  CloseFile(f);      // закрываем файл
end;

Текстовый файл "текст.txt" должен лежать в одной папке с програмой или нужно будет прописать полный путь к нему.



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

Скачать: CL | DM;



Память: 0.46 MB
Время: 0.01 c
2-1197741528
Elec3C
2007-12-15 20:58
2008.01.13
Проверка клавиш


2-1197704849
Chingachguk
2007-12-15 10:47
2008.01.13
Asp в delphi 6.Не Net.


4-1182121776
NOOBIX
2007-06-18 03:09
2008.01.13
Я многого достиг в Delphi


15-1197027915
oldman
2007-12-07 14:45
2008.01.13
Минимальный размер IP-пакета...


15-1196879548
Cerberus
2007-12-05 21:32
2008.01.13
Не заходит на опредёленный адрес.




   Наверх