Delphi I/o Error 102
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more delphi 7 i/o error 102 about Stack Overflow the company Business Learn more about hiring developers or posting ads delphi i o error 103 with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow i/o error 105 delphi is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Delphi7, I/O error 102, When Assigning a file up vote 0 down i/o error 103 vote favorite My teacher assigned me to create a simple project: Create a form, which the user has to complete and when he presses the submit button, then the program should write all the information in different textfiles (For example, 1 textfile for their first name, onother for their last name etc) (i know it sounds insane, but a project is a project). Anyway, i tried this: procedure TForm1.Button1Click(Sender: TObject); //On Click var F:Array[1..20]of textfile; //20 fields, 1 txt each one Firstname,Fname:string; //Location,Field Begin Firstname:=ExtractFilePath(Paramstr(0))+'User\Identity\FirstName.txt'; //Location Fname:=Edit1.text; AssignFile(f[1],Firstname); Rewrite(f[1],Firstname); writeln(f[1],Fname); closefile(f[1]); end; I searched on the google about this error: I/O error 102, All i found is that delphi does not assign the file, for some reasons. But i still don't get why, the code looks absolutely correct and logical to me, Perhaps what i tried: F:Array[1..20]of Textfile is wrong, the only reason i tried it, is because i wanted to start writing f1,f2,...,f20 What do you think i should do? Thanks file delphi assign share|improve this question asked May 12 '13 at 11:28 user2296565 681315 The second argument of Rewrite should not be Firstname. Does it even compile? Also, you need to spend more time on chosing good variable names. Firstname is the path to the file containing the first name, and Fname is the first name. Not good. –Andreas Rejbrand May 12 '13 at 11:31 No, it is correct...even if i change it, the error will be raised –user2296565 May 12 '13 at 11:32 No, it is definitely not correct. Trust me. A string as second argument of Rewrite doesn't make any sense. –Andreas Rejbrand May 12 '13
state. (If the application does not include the System.SysUtils unit, the exception causes the application to terminate). Handling I/O Errors In the {$I-} state, the program continues to execute, and the error is reported by the IOResult function. I/O Error List The following table lists all I/O errors, numbers, and descriptions. Number Name Description 100 Disk read error Reported by Read on a typed file if you attempt to read past the end of the file. 101 Disk write error Reported by CloseFile, Write, WriteIn, or Flush if the disk becomes full. 102 File not assigned Reported by Reset, Rewrite, Append, Rename, or Erase http://stackoverflow.com/questions/16506869/delphi7-i-o-error-102-when-assigning-a-file if the file variable has not been assigned a name through a call to Assign or AssignFile. 103 File not open Reported by CloseFile, Read Write, Seek, Eof, FilePos, FileSize, Flush, BlockRead, or BlockWrite if the file is not open. 104 File not open for input Reported by Read, Readln, Eof, Eoln, SeekEof, or SeekEoln on a text file if the file is not open for input. 105 File not open http://docwiki.embarcadero.com/RADStudio/Seattle/en/Input-Output_Errors for output Reported by Write or Writeln on a text file if you do not generate a Console application. 106 Invalid numeric format Reported by Read or Readln if a numeric value read from a text file does not conform to the proper numeric format. See Also Exception Handling Resolving Internal Errors (Delphi) Delphi Runtime Errors Fatal errors Operating system errors Retrieved from "http://docwiki.embarcadero.com/RADStudio/Seattle/e/index.php?title=Input-Output_Errors&oldid=227166" Category: RAD Studio ReferenceHidden category: AMMigrate Views Page Discussion View source History Personal tools Create account Log in Search RAD Studio Seattle Seattle Examples and Samples Seattle Libraries Main Page - Seattle Topics Wiki What's New Tutorials FireMonkey Application Platform Multi-Device Applications Getting Started Steps in Developing a Project Key Application Types FireDAC Windows Developer's Guide Modeling Tools IDE Reference and Utilities Delphi Reference C++ Reference Subject Index HTML5 Builder Newer Versions Berlin Topics Previous Versions XE8 Topics XE7 Topics XE6 Topics XE5 Topics XE4 Topics XE3 Topics XE2 Topics XE Topics 2010 Topics In other languages Deutsch Français 日本語 Assistance Known Problems and Recent Fixes Random Page Recent changes Help Tools What links here Related changes Special pages Printable version Permanent link Page information This page was last modified on 28 May 2014, at 14:34. Privacy policy About RAD Studio Disclaimers Help Feedback (QP, email)
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 the Windows API (and former DOS) IO errors, which are also the IO errors often returned by Delphi programs, and http://www.freepascal.org/docs-html/rtl/system/ioresult.html 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 o 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 Error i/o error 102 :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:// The
Description IOresult contains the result of any input/output call, when the {\$i-} compiler directive is active, disabling IO checking. When the flag is read, it is reset to zero. If IOresult is zero, the operation completed successfully. If non-zero, an error occurred. The following errors can occur: dos errors : 2 File not found. 3 Path not found. 4 Too many open files. 5 Access denied. 6 Invalid file handle. 12 Invalid file-access mode. 15 Invalid disk number. 16 Cannot remove current directory. 17 Cannot rename across volumes. I/O errors : 100 Error when reading from disk. 101 Error when writing to disk. 102 File not assigned. 103 File not open. 104 File not opened for input. 105 File not opened for output. 106 Invalid number. Fatal errors : 150 Disk is write protected. 151 Unknown device. 152 Drive not ready. 153 Unknown command. 154 CRC check failed. 155 Invalid drive specified.. 156 Seek error on disk. 157 Invalid media type. 158 Sector not found. 159 Printer out of paper. 160 Error when writing to device. 161 Error when reading from device. 162 Hardware failure. Errors None. Example Program Example35; { Program to demonstrate the IOResult function. } Var F : text; begin Assign (f,paramstr(1)); {$i-} Reset (f); {$i+} If IOresult<>0 then writeln ('File ',paramstr(1),' doesn''t exist') else writeln ('File ',paramstr(1),' exists'); end. Documentation generated on: Nov 14 2015