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

Вниз

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

 
Andrews   (2002-03-27 15:40) [0]

Привет всем!

Не могу открыть файл на чтение, лежащий в сетевой папке с параметрами доступа "Только чтение", возникает ошибка "I/O error 65", если открыть "Полный доступ" все работает :o(

Файл открываю так:

AssignFile(f, FN);
Reset(F); //ошибка здесь

где FN := "\\server\data\ddmain.db";

где server имя компьютера в сети, а data пресловутая папка открытая для общего доступа

Заранее всем спасибо.


 
John Kayfolom   (2002-03-27 16:48) [1]

Reset открывает файл на чтение и запись. Нужно юзать OpenFile
Из хэлпа дельфей:
HFILE OpenFile(
LPCSTR lpFileName, // pointer to filename
LPOFSTRUCT lpReOpenBuff,// pointer to buffer for file information
UINT uStyle // action and attributes);
Где uStyle установить в OF_READ (Opens the file for reading only.)


 
John Kayfolom   (2002-03-27 16:53) [2]

В догонку - есть обертка апишной функции:
unit system
function FileOpen(const FileName: string; Mode: LongWord): Integer;
Вот кусок из хелпа:
var
iFileHandle: Integer;
iFileLength: Integer;
iBytesRead: Integer;
Buffer: PChar;
i: Integer
begin
if OpenDialog1.Execute then
begin
try
iFileHandle := FileOpen(OpenDialog1.FileName, fmOpenRead);
iFileLength := FileSeek(iFileHandle,0,2);
FileSeek(iFileHandle,0,0);
Buffer := PChar(AllocMem(iFileLength + 1));
iBytesRead = FileRead(iFileHandle, Buffer, iFileLength);
FileClose(iFileHandle);
for i := 0 to iBytesRead-1 do
begin
StringGrid1.RowCount := StringGrid1.RowCount + 1;
StringGrid1.Cells[1,i+1] := Buffer[i];
StringGrid1.Cells[2,i+1] := IntToStr(Integer(Buffer[i]));
end;
finally
FreeMem(Buffer);
end;
end;
end;


 
Andrews   (2002-03-27 17:13) [3]

Что самое смешное, если файл лежит на флопе защищенным от записи все работает, никахих ошибок, а весь огород городится ради f

for I := 1 to 9 do
begin
FN := EDB_Path+S1+"."+MDiskExt[I];
if FileExists(FN) then
begin
AssignFile( f, FN);
Reset( F);
Size := Size + FileSize( F);
CloseFile( f);
end;
end;


 
ASV   (2002-03-29 11:18) [4]

Перед Reset добавь строку FileMode := 0



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

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

Наверх





Память: 0.45 MB
Время: 0.006 c
1-30741
neodiX
2002-05-29 20:33
2002.06.10
Опять Jpeg & TStream


1-30906
alkmas
2002-05-30 09:59
2002.06.10
Создание BPL


4-31050
vsl1969
2002-04-09 09:16
2002.06.10
Hook


1-30878
Alex is Fecit
2002-05-25 22:10
2002.06.10
3D CHART


4-31056
новенький в Делфи
2002-04-10 02:22
2002.06.10
Почему не работает?





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