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

Вниз

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

 
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 вся ветка

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

Наверх





Память: 0.46 MB
Время: 0.077 c
2-1197472090
account1024
2007-12-12 18:08
2008.01.13
Кол-во элементов TreeView


15-1196919658
Dreamse
2007-12-06 08:40
2008.01.13
Антивирус ( Вопросы по встраиванию защиты в своё приложение )


15-1197234171
Grain_II
2007-12-10 00:02
2008.01.13
алгоритм предсказания результатов грядущих выборов


15-1196885533
Cyrax
2007-12-05 23:12
2008.01.13
Авторизованные дилеры и гарантийный ремонт...


3-1189069315
Sonia
2007-09-06 13:01
2008.01.13
ORA-02064: distributed operation not supported





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
Английский Французский Немецкий Итальянский Португальский Русский Испанский