![]() |
| ||
|
|
Новости |
Поиск |
FAQ |
Статьи |
Книги |
Новости VCL
| | Форумы ЧАТ |
Орешник |
|
| |||
| |||
« предыдущая ветвь | форум | следующая ветвь »
Не могу открыть на чтение файл, который занят другим процесом... [D7, Win2k]
Шурик Ш © (2005-03-11 16:39:00)Однако, через F3 в FARе или через блокнот в Винде он очень даже легко просматривается! Почему? И как все-таки его открыть?
Шурик Ш (2005-03-11 17:17:00) [1]WhiteGuy © (11.03.05 17:14) [7]
Надо в командной строке печатать! :-)
Indicates the access mode on typed and untyped files opened by the Reset procedure.
Unit
System
Category
IO routines
Delphi syntax:
var FileMode: Byte = 2;
Description
In Delphi code, FileMode determines the access mode to use when typed and untyped files (not text files) are opened using the Reset procedure.
The default FileMode is 2 (Read/Write access). Assigning another value to FileMode causes all subsequent Resets to use that mode. The SysUtils unit declares a number of file open mode constants that can be assigned to the FileMode variable.
Note: Be sure to reset FileMode before calling Reset with a read-only file. Even if you are only reading from the file, the default FileMode value (Read/Write access) will cause an attempt to open a read-only file to fail.
Warning: FileMode is declared as a variable, not as a threadvar. Therefore this variable is not thread-safe.
WhiteGuy (2005-03-11 17:14:00) [2]
> Шурик Ш (11.03.05 17:08) [6]
> 2 WhiteGuy © (11.03.05 16:58) [5]
> FileMode + F1
Ну я чиста кароче запускаю Блакнот, печятаю там "FileMode", нажымаю F1 и ничё не праисходитЪ! :)
Шурик Ш (2005-03-11 17:08:00) [3]2 WhiteGuy © (11.03.05 16:58) [5]
FileMode + F1
WhiteGuy (2005-03-11 16:58:00) [4]2 Шурик Ш [2]
> Пробывал:
> AssignFile(F, MLGFileName);
> FileMode := 0;
> Reset(F);
Шурик, а чё такое FileMode??
Шурик Ш (2005-03-11 16:56:00) [5]Спасибо! Помогло:
S := TFileStream.Create(MLGFileName, fmOpenRead or fmShareDenyNone);
А что же значит, то что я добавил?
BiN (2005-03-11 16:50:00) [6]делай
S := TFileStream.Create(MLGFileName, fmOpenRead or fmShareDenyWrite (или fmShareDenyNone));
Шурик Ш (2005-03-11 16:46:00) [7]Пробывал:
AssignFile(F, MLGFileName);
FileMode := 0;
Reset(F);
И еще пробывал:
S := TFileStream.Create(MLGFileName, fmOpenRead);
BiN (2005-03-11 16:44:00) [8]Как файл открываешь?
Пробуй
CreateFile(..., FILE_SHARE_READ or FILE_SHARE_WRITE, ..