Форум: "Сети";
Текущий архив: 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