Delphi Io Error 6
Contents |
16bit Delphi but it gives me I/O error 6 under Delphi 32bit. I'm reading and writing a file inplace and it looks like this error is invalid file handle, But I'm not io error 103 delphi sure. Does anyone know ? Torstein Petterse Delphi Developer Thu, 19 Nov 1998 03:00:00
Io Error 32 Delphi
GMT Re:I/O error 6 Quote> j...@atl.mindspring.com (john c. taylor) wrote in article <4osqb6$...@mule1.mindspring.com>... Quote> Can anyone tell me what an I/O error 6 delphi i/o error 6 is ? I've got a piece of code > that runs fine under 16bit Delphi but it gives me I/O error 6 under > Delphi 32bit. I'm reading and writing a file inplace and it looks > like this error is invalid file handle, But I'm not sure. > Does anyone know ? Error code 6 means invalid file handle. It may be that you have declared the read buffer before the File variable, and are trying to read more data than the buffer can hold. The buffer overflowes and your File variable is overwritten with the buffer overflow. I once had this problem myself and was unable to find what I/O error 6 meant. I had to find an old manual from Turbo Pascal for Windows to find a description of the error code. Hope this helps. Torstein Pettersen t...@online.no Torstein Petterse Delphi Developer Thu, 19 Nov 1998 03:00:00 GMT Re:I/O error 6 Quote> j...@atl.mindspring.com (john c. taylor) wrote in article <4osqb6$...@mule1.mindspring.com>... Quote> Can anyone tell me what an I/O error 6 is ? I've got a piece of code > that runs fine under 16bit Delphi but it gives me I/O error 6 under > Delphi 32bit. I'm reading and writing a file inplace and it looks > like this error is invalid file handle, But I'm not sure. > Does anyone know ? Error code 6 means invalid file handle. It may be that you have declared the read buffer before the File variable, and are trying to read more data than the buffer can hold. The buffer overflowes and your File variable is overwritten with the buffer overflow. I once had this problem myself and was unable to find what I/O error 6 meant. I had to find an old manual from Turbo Pascal for Windows to find a description of the error code. Hope this helps. Torstein Pettersen t...@online.no Svante Granqvis Delphi Developer Fri, 20 Nov 1998 03:00:00 GMT Re:I/O error 6 Quotejohn c. taylor wrote: > Can anyone tell me what an
I occasionally get I/O error 6 or 32. Heres my code: : [source code here, see previous message] In the copy below of the http://www.delphigroups.info/2/0b/141274.html first lines of your FormCreate procedure, I marked and commented the lines that can cause errors. Please let me know if this info solved your problem :) procedure TForm1.FormCreate(Sender: TObject); var SR: TSearchRec; Done: string; FName: http://www.festra.com/wwwboard/messages/13009.html string; InFile: textfile; LineofText: TextLines; i: integer; DotheEncryption: Boolean; begin DotheEncryption := False; Twofish1.InitialiseString('JanDunn'); If FindFirst('*.doc', faAnyFile, SR) = 0 then FName := SR.Name; { But... if FindFirst did NOT find a file, then FName doesn't contain a valid filename ! } AssignFile( InFile, Fname ); { If FName doesn't contain a valid filename, then InFile now points to a non-existing file } Reset(Infile); for i := 1 to 5 do begin { If InFile points to a non-existing file, then the next line will give an I/O error 6 } Readln(Infile, LineofText[i]); end; // etc... end; Related articles Follow Ups
DllForms SqlCommands XML XML Extension API MessageBox API DELPHI MemoryLeakage I|OERROR GuestBook Malai Appendix A - Delphi I/O ErrorsThanks goes out to Erik Martin http://delphi-techie.faithweb.com/rich_text_4.html for posting these Delphi IO errors on his web site. The following are http://www.cyberforum.ru/delphi-beginners/thread171220.html the Windows API (and former DOS) IO errors, which are also the IO errors often returned by Delphi programs, and which are generally difficult to find reference for, and are especially difficult to find referenced as Delphi errors.Some of the high-numbered sections toward the end contain Windows API errors which are not truely io error be IO errors, but which may or may not be reported as such in programs.I/O Error 1:// IO Error 1L// ERROR_INVALID_FUNCTION // MessageText:// Incorrect function.I/O Error 2:// IO Error 2L// ERROR_FILE_NOT_FOUND// MessageText:// The system cannot find the file specified.I/O Error 3:// IO Error 3L// ERROR_PATH_NOT_FOUND// MessageText:// The system cannot find the path specified.I/O Error 4:// IO Error 4L// ERROR_TOO_MANY_OPEN_FILES// MessageText:// The system cannot open the file.I/O delphi io error Error :5// IO Error 5L// ERROR_ACCESS_DENIED// MessageText:// Access is denied.I/O Error 6:// IO Error 6L// ERROR_INVALID_HANDLE// MessageText:// The handle is invalid.I/O Error 7:// IO Error 7L// ERROR_ARENA_TRASHED// MessageText:// The storage control blocks were destroyed.I/O Error 8:// IO Error 8L// ERROR_NOT_ENOUGH_MEMORY// MessageText:// Not enough storage is available to process this command.I/O Error 9:// IO Error 9L// ERROR_INVALID_BLOCK// MessageText:// The storage control block address is invalid.I/O Error 10:// IO Error 10L// ERROR_BAD_ENVIRONMENT// MessageText:// The environment is incorrect.I/O Error 11:// IO Error 11L// ERROR_BAD_FORMAT// MessageText:// An attempt was made to load a program with an// incorrect format.I/O Error 12:// IO Error 12L// ERROR_INVALID_ACCESS// MessageText:// The access code is invalid.I/O Error 13:// IO Error 13L// ERROR_INVALID_DATA// MessageText:// The data is invalid.I/O Error 14:// IO Error 14L// ERROR_OUTOFMEMORY// MessageText:// Not enough storage is available to complete this operation.I/O Error 15:// IO Error 15L// ERROR_INVALID_DRIVE// MessageText:// The system cannot find the drive specified.I/O Error 16:// IO Error 16L// ERROR_CURRENT_DIRECTORY// MessageText:// The directory cannot be removed.I/O Error 17:// IO Error 17L// ERROR_NOT_SAME_DEVICE// MessageText:// The system cannot move the file// to a different disk drive.I/O Error 18:// IO Error 18L// ERROR_NO_MORE_FILES// MessageText:// There are no more files.I/O Error 19:// IO Error 19L// ERROR_WRITE_PROTECT// MessageText:/
Тесты Блоги Сообщество Поиск Ссылки сообщества Социальные группы Поиск Google по форуму Поиск Yandex по форуму Поиск по форуму Расширенный поиск Тесты Список тестов К странице... @STL1te 6 / 5 / 0 Регистрация: 08.12.2009 Сообщений: 105 01.10.2010, 13:27 I/O error 6 #1 при выполнении программа стопорится на строке Delphi1 while not eof(f) do при этом не давая даже ввести имя открываемого файла.. т.е строки Delphi1 2 writeln ('Ââåäèòå èìÿ ГґГ*éëГ*:'); read (f_name); она просто пропускает. вот код самой процедуры и ниже скрин ошибки. Процедура просто выводит на экран содержимое ранее созданного файла. Почему выскакивает ошибка не знаю..(( Delphi1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 procedure OpenFile (var f:CharFile); var f_name:string; ch:char; begin f_name:=''; writeln ('Ââåäèòå èìÿ ГґГ*éëГ*:'); read (f_name); assign (f,f_name); reset(f); while not eof(f) do begin read (f,ch); write (ch); end; closefile(f); end; Similar Эксперт 41792 / 34177 / 6122 Регистрация: 12.04.2006 Сообщений: 57,940 01.10.2010, 13:27 I/O error 6 Посмотрите здесь: I/O error 32 Delphi Delphi error buttonDelphi I/O errorошибка Socket Error #11001 или socket error #10051 Delphi Error Form Delphi После регистрации реклама в сообщениях будет скрыта и будут доступны все возможности форума. @anonimus 2148 / 1237 / 31 Регистрация: 28.04.2010 Сообщений: 4,531 01.10.2010, 13:29 I/O error 6 #2 может потому что ты его (файл) не закрыл после assign и вообще лучше AssignFile использовать @STL1te 6 / 5 / 0 Регистрация: 08.12.2009 Сообщений: 105 01.10.2010, 13:46 [ТС] I/O error 6 #3 вот весь код.. вроде файл закрываю ещё в процедуре CreateFile.. Delphi1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 program Project2; {$APPTYPE CONSOLE} uses SysUtils, Windows; type CharFile=file of char; procedure CreateFile (var f:CharFile); var f_name:string; ch:char; begin f_name:=''; write ('Ââåäèòå èìÿ ГґГ*éëГ*:'); readln (f_name); assignfile (f,f_name); rewrite (f); writeln ('Ââåäèòå ýëåìåГ*ГІГ» ГґГ*éëГ* (ГЄГ®Г*ГҐГ¶ ГґГ*éëГ* - .)'); repeat read (ch); write (f,ch); until ch='.'; closef