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

Вниз

Не могу открыть на чтение файл, который занят другим процесом...   Найти похожие ветки 

 
Шурик Ш   (2005-03-11 16:39) [0]

Однако, через F3 в FARе или через блокнот в Винде он очень даже легко просматривается! Почему? И как все-таки его открыть?


 
BiN ©   (2005-03-11 16:44) [1]

Как файл открываешь?

Пробуй
CreateFile(..., FILE_SHARE_READ or FILE_SHARE_WRITE, ..


 
Шурик Ш   (2005-03-11 16:46) [2]

Пробывал:
   AssignFile(F, MLGFileName);
   FileMode := 0;
   Reset(F);

И еще пробывал:
   S := TFileStream.Create(MLGFileName, fmOpenRead);


 
BiN ©   (2005-03-11 16:50) [3]

делай
  S := TFileStream.Create(MLGFileName, fmOpenRead or fmShareDenyWrite (или fmShareDenyNone));


 
Шурик Ш   (2005-03-11 16:56) [4]

Спасибо! Помогло:
 S := TFileStream.Create(MLGFileName, fmOpenRead or fmShareDenyNone);

А что же значит, то что я добавил?


 
WhiteGuy ©   (2005-03-11 16:58) [5]

2 Шурик Ш [2]


> Пробывал:
>    AssignFile(F, MLGFileName);
>    FileMode := 0;
>    Reset(F);


Шурик, а чё такое FileMode??


 
Шурик Ш   (2005-03-11 17:08) [6]

2 WhiteGuy ©   (11.03.05 16:58) [5]
FileMode + F1


 
WhiteGuy ©   (2005-03-11 17:14) [7]


> Шурик Ш   (11.03.05 17:08) [6]
> 2 WhiteGuy ©   (11.03.05 16:58) [5]
> FileMode + F1

Ну я чиста кароче запускаю Блакнот, печятаю там "FileMode", нажымаю F1 и ничё не праисходитЪ! :)


 
Шурик Ш   (2005-03-11 17:17) [8]

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.



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

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

Наверх





Память: 0.46 MB
Время: 0.039 c
1-1110553752
awk
2005-03-11 18:09
2005.03.27
TabSheet


1-1110983113
hgd
2005-03-16 17:25
2005.03.27
Карты IMG открыть


3-1109418725
jz6
2005-02-26 14:52
2005.03.27
Не работает ОТКАТ в ТРАНЗАКЦИИ


1-1110983578
hgd
2005-03-16 17:32
2005.03.27
Прервать onclose


1-1110811572
tytus
2005-03-14 17:46
2005.03.27
Работа с большими файлами.





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