Содержание
- error messages
- Contents
- Errors during compilation
- Errors during program execution
- If the bug is already known
- If the bug is not already known
- RunError
- RunError
error messages
Contents
Errors during compilation
Unless the error identifies itself as an internal compiler error, it is unlikely that the error is caused by a bug in the compiler or its runtime library. Syntax errors are almost always due to incorrect code. Refer to the FPC Parser Messages documentation for a listing of the various Error and Warning messages produced by the FPC Parser along with explanations of them.
If you encounter an error while compiling your code and are unable to resolve it yourself, please use the FPC and Lazarus Forums, write to the Lazarus or Free Pascal mailing list or join the #fpc or #lazarus-ide IRC channel. The problem may then be solved more quickly.
If an error is encountered during compilation, the compiler does not generate an executable program. See further compile time errors.
Errors during program execution
The Free Pascal Compiler inserts code to detect a large number of error situations which might occur during program execution (eg divide by zero). If such an error situation occurs, the standard run-time library will terminate the program and print a runtime error number and the address at which the error occurred. See further runtime errors.
If you encounter a runtime error while running your program and are unable to resolve it yourself, please use the FPC and Lazarus Forums, write to the Lazarus or Free Pascal mailing list or join the #fpc or #lazarus-ide IRC channel.
If the bug is already known
Use the FPC and Lazarus Bug Tracker’s search capabilities.
Known issues. Tip: If you are experiencing problems, for example with TEdit.SelStart -> try searching «SelStart» (in quotes). If the bug is known:
- reopen if the issue is resolved or the issue is closed — use the Reopen Issue button.
- add your own note to the discussion if you received this error in another situation.
To observe any changes to your bug report — use the Monitor Issue button.
Note: You need to login to your account: Login/Create an account.
If the bug is not already known
- Go to the FPC and Lazarus Bug Tracker.
- You must be logged in: Login/Create account.
- Visit Report Issue. Fill in as many fields as possible. The more accurate the better.
- The OS and Product Version fields are especially important. If the data is not enough, they will not help you! Don’t forget to mention the system features (big endian or 64-bit).
- It is often helpful to send in a small test program to resolve the problem as soon as possible.
- If you find graphic artifacts, it would not be superfluous to send a screenshot (in png or jpeg, but not in BMP!).
- If it fails, try creating a backtrace. More information — Creating a Backtrace with GDB.
- If possible, observe the behaviour of the buggy program on different platforms or with different widgetsets.
It is also possible to get a bug fixed by paying for a solution, see Bounties.
Источник
RunError
A RunError is a low-level error emitted by the Free Pascal Run Time Library. In Lazarus, RunErrors are raised as exceptions.
# | Short description | Explanation | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | Invalid function number | An invalid operating system call was attempted. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
2 | File not found | Reported when trying to erase, rename or open a non-existent file. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
3 | Path not found | Reported by the directory handling routines when a path does not exist or is invalid. Also reported when trying to access a non-existent file. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
4 | Too many open files | The maximum number of files currently opened by your process has been reached. Certain operating systems limit the number of files which can be opened concurrently, and this error can occur when this limit has been reached. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
5 | File access denied | Permission to access the file is denied. This error might be caused by one of several reasons:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
6 | Invalid file handle | If this happens, the file variable you are using is trashed; it indicates that your memory is corrupted. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
12 | Invalid file access code | Reported when a reset or rewrite is called with an invalid FileMode value. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
15 | Invalid drive number | The number given to the Getdir or ChDir function specifies a non-existent disk. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
16 | Cannot remove current directory | Reported when trying to remove the currently active directory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
17 | Cannot rename across drives | You cannot rename a file such that it would end up on another disk or partition. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
100 | Disk read error | An error occurred when reading from disk. Typically happens when you try to read past the end of a file. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
101 | Disk write error | Reported when the disk is full, and you’re trying to write to it. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
102 | File not assigned | This is reported by Reset, Rewrite, Append, Rename and Erase, if you call them with an unassigned file as a parameter. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
103 | File not open | Reported by the following functions : Close, Read, Write, Seek, EOf, FilePos, FileSize, Flush, BlockRead, and BlockWrite if the file is not open. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
104 | File not open for input | Reported by Read, BlockRead, Eof, Eoln, SeekEof or SeekEoln if the file is not opened with Reset. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
105 | File not open for output | Reported by write if a text file isn’t opened with Rewrite. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
106 | Invalid numeric format | Reported when a non-numeric value is read from a text file, and a numeric value was expected. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
107 | Invalid enumeration | Reported when a text representation of an enumerated constant cannot be created in a call to str or write(ln). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
150 | Disk is write-protected | (Critical error) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
151 | Bad drive request struct length | (Critical error) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
152 | Drive not ready | (Critical error) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
154 | CRC error in data | (Critical error) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
156 | Disk seek error | (Critical error) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
157 | Unknown media type | (Critical error) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
158 | Sector Not Found | (Critical error) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
159 | Printer out of paper | (Critical error) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
160 | Device write fault | (Critical error) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
161 | Device read fault | (Critical error) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
162 | Hardware failure | (Critical error) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
200 | Division by zero | The application attempted to divide a number by zero. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
201 | Range check error | If you compiled your program with range checking on, then you can get this error in the following cases:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
202 | Stack overflow error | The stack has grown beyond its maximum size (in which case the size of local variables should be reduced to avoid this error), or the stack has become corrupt. This error is only reported when stack checking is enabled. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
203 | Heap overflow error | The heap has grown beyond its boundaries. This is caused when trying to allocate memory explicitly with New, GetMem or ReallocMem, or when a class or object instance is created and no memory is left. Please note that, by default, Free Pascal provides a growing heap, i.e. the heap will try to allocate more memory if needed. However, if the heap has reached the maximum size allowed by the operating system or hardware, then you will get this error. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
204 | Invalid pointer operation | You will get this in several cases:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
205 | Floating point overflow | You are trying to use or produce real numbers that are too large. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
206 | Floating point underflow | You are trying to use or produce real numbers that are too small. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
207 | Invalid floating point operation | Can occur if you try to calculate the square root or logarithm of a negative number. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
210 | Object not initialized | When compiled with range checking on, a program will report this error if you call a virtual method without having called its object’s constructor. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
211 | Call to abstract method | Your program tried to execute an abstract virtual method. Abstract methods should be overridden, and the overriding method should be called. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
212 | Stream registration error | This occurs when an invalid type is registered in the objects unit. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
213 | Collection index out of range | You are trying to access a collection item with an invalid index (objects unit). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
214 | Collection overflow error | The collection has reached its maximal size, and you are trying to add another element (objects unit). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
215 | Arithmetic overflow error | This error is reported when the result of an arithmetic operation is outside of its supported range. Contrary to Turbo Pascal, this error is only reported for 32-bit or 64-bit arithmetic overflows. This is due to the fact that everything is converted to 32-bit or 64-bit before doing the actual arithmetic operation. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
216 | General Protection fault | The application tried to access invalid memory space. This can be caused by several problems:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
217 | Unhandled exception occurred | An exception occurred, and there was no exception handler present. The sysutils unit installs a default exception handler which catches all exceptions and exits gracefully. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
218 | Invalid value specified | Error 218 occurs when an invalid value was specified to a system call, for instance when specifying a negative value to a seek() call. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
219 | Invalid typecast | Thrown when an invalid typecast is attempted on a class using the as operator. This error is also thrown when an object or class is typecast to an invalid class or object and a virtual method of that class or object is called. This last error is only detected if the -CR compiler option is used. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
222 | Variant dispatch error | No dispatch method to call from variant. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
223 | Variant array create | The variant array creation failed. Usually when there is not enough memory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
224 | Variant is not an array | This error occurs when a variant array operation is attempted on a variant which is not an array. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
225 | Var Array Bounds check error | This error occurs when a variant array index is out of bounds. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
227 | Assertion failed error | An assertion failed, and no AssertErrorProc procedural variable was installed. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
229 | Safecall error check | This error occurs is a safecall check fails, and no handler routine is available. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
231 | Exception stack corrupted | This error occurs when the exception object is retrieved and none is available. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
232 | Threads not supported | Thread management relies on a separate driver on some operating systems (notably, Unixes). The unit with this driver needs to be specified on the uses clause of the program, preferably as the first unit (cthreads on unix).
Add in the top of the first Pascal unit (usually the project .lpr file)
Источник RunErrorA RunError is a low-level error emitted by the Free Pascal Run Time Library. In Lazarus, RunErrors are raised as exceptions.
|
gylayko 30 / 29 / 15 Регистрация: 28.09.2011 Сообщений: 449 |
||||||||
1 |
||||||||
15.03.2013, 14:34. Показов 17420. Ответов 14 Метки нет (Все метки)
поставил на закрытие формы обновление содержимого файла
здесь на строке while not eof (o) do выдает ошибку i/o error 104
в чем может быть проблема?
__________________
0 |
Programming Эксперт 94731 / 64177 / 26122 Регистрация: 12.04.2006 Сообщений: 116,782 |
15.03.2013, 14:34 |
Ответы с готовыми решениями:
unit Unit2; interface… Ошибка i/0 error 104
I/O error 104 в Delphi 7 14 |
angstrom |
||||
15.03.2013, 14:36 |
2 |
|||
С командой Rewrite(o)
бессмысленна. |
gylayko 30 / 29 / 15 Регистрация: 28.09.2011 Сообщений: 449 |
||||
15.03.2013, 14:37 [ТС] |
3 |
|||
С командой Rewrite(o)
бессмысленна. в смысле? если сделать Reset, запишется пустой файл!
0 |
angstrom |
|
15.03.2013, 14:56 |
4 |
С чего это вдруг? |
30 / 29 / 15 Регистрация: 28.09.2011 Сообщений: 449 |
|
15.03.2013, 14:58 [ТС] |
5 |
С чего это вдруг? как с чего? с того, что я попробовал! и сообщаю результат!
0 |
angstrom |
||||
15.03.2013, 15:13 |
6 |
|||
Перестань городить чушь.
Этот твой код сохранения, но не забывай Rewrite создаёт новый файл. При его наличии очищает полностью. |
gylayko 30 / 29 / 15 Регистрация: 28.09.2011 Сообщений: 449 |
||||
15.03.2013, 16:15 [ТС] |
7 |
|||
Перестань городить чушь.
Этот твой код сохранения, но не забывай Rewrite создаёт новый файл. При его наличии очищает полностью. все, я просто не закрывал файл
0 |
898 / 345 / 65 Регистрация: 11.02.2012 Сообщений: 1,502 |
|
15.03.2013, 16:31 |
8 |
writeln;
0 |
IKosoulin 0 / 0 / 0 Регистрация: 11.07.2013 Сообщений: 11 |
||||
13.12.2014, 17:37 |
9 |
|||
Ребят, помогите мне плиз, почему при запуске exe та же ошибка 104.
0 |
пофигист широкого профиля 4602 / 3062 / 850 Регистрация: 15.07.2013 Сообщений: 17,661 |
|
13.12.2014, 19:43 |
10 |
C:i1.txt Что это такое?
0 |
0 / 0 / 0 Регистрация: 11.07.2013 Сообщений: 11 |
|
14.12.2014, 01:44 |
11 |
Сори, это просто очепятка, проблема не в этом.
0 |
пофигист широкого профиля 4602 / 3062 / 850 Регистрация: 15.07.2013 Сообщений: 17,661 |
|
14.12.2014, 01:50 |
12 |
А кто в этот файл что-то пишет?
0 |
IKosoulin 0 / 0 / 0 Регистрация: 11.07.2013 Сообщений: 11 |
||||
14.12.2014, 10:56 |
13 |
|||
Другая программа. Добавлено через 14 минут
0 |
northener пофигист широкого профиля 4602 / 3062 / 850 Регистрация: 15.07.2013 Сообщений: 17,661 |
||||
14.12.2014, 13:33 |
14 |
|||
Невнимательно вчера посмотрел код
А где открытие файла?
0 |
IKosoulin 0 / 0 / 0 Регистрация: 11.07.2013 Сообщений: 11 |
||||
14.12.2014, 16:15 |
15 |
|||
Использую reset
0 |
Im very new to using files and im really struggling to fix this any help would be great.
It seems that the error is coming from my read array function but not entirely
sure i am also not to sure what the 104 error really means
thanks in advance
program ReadFromFile;
type
lineArray = array [0..19] of String;
procedure PrintArray(lines: lineArray);
var
i: Integer;
begin
for i:=0 to High(lines) do
begin
WriteLn('Text is: ', lines[i], ' Line number is: ', i);
end;
end;
function ReadArray(var myFile: TextFile):lineArray;
var
count : Integer;
lines : lineArray;
i: Integer;
begin
ReadLn(myFile, count);
for i := 0 to count do
begin
ReadLn(myFile, lines[i]);
end;
result := lines;
end;
procedure Main();
var
myFile: TextFile;
line: lineArray;
begin
AssignFile(myFile, 'mytestfile.dat');
ReWrite(myFile);
line:=ReadArray(myFile);
Close(myFile);
AssignFile(myFile, 'mytestfile.dat');
Reset(myFile);
PrintArray(line);
Close(myFile);
end;
begin
Main();
end.
asked Oct 27, 2017 at 5:55
1
You don’t know what that error means. Neither do I off the top of my head. So, let’s look it up in the documentation and find out. Websearch takes us here: https://www.freepascal.org/docs-html/user/userap4.html
File not open for input
Reported by Read, BlockRead, Eof, Eoln, SeekEof or SeekEoln if the file is not opened with Reset.
You have your calls to open the file the wrong way round. Call Reset
to open for reading, Rewrite
to open for writing.
Notes:
- Looping from 0 to
count
will performcount + 1
iterations. I’d expect to see you looping from 0 tocount - 1
. - You don’t check whether your array is long enough. You therefore run the risk of a buffer overrun. A dynamic array would avoid this.
- It’s not clear why you open the file for a second time when you print the contents to the console.
- You could have looked up the error code yourself. Please take the hint to do web search the next time you encounter an error like this.
answered Oct 27, 2017 at 7:06
David HeffernanDavid Heffernan
596k42 gold badges1055 silver badges1471 bronze badges
3
← →
Steep
(2008-01-13 20:52)
[0]
эх… снова я…
Project raised exception class EInOutError with message «I/O error 104»
Я читаю файл — числа разделенные «;»
и заношу в StringGrid и массив.
Программа запускается — читает первые десять и вылетает
procedure TForm1.Button1Click(Sender: TObject);
var
f: TextFile;
s, stemp: string;
SArray: array[0..9, 0..59] of real;
r,c,k: integer;
begin
if OD.Execute=true then
begin
AssignFile(F, OD.FileName);
Reset(f);
r := 0;
//Çäåñü ÷èòàåì âåñü ôàéë
while not eof(f) do
begin
c := 0;
ReadLn(f, s);
//Èùåì â ñòðîêå äàííûå
Showmessage(s + "; new string; r=" + IntToStr(r) + "; c=" + IntToStr(c));
while s<>"" do
begin
k := Pos(";", s); //ïîçèöèÿ
if k=0 then k := Length(s);
stemp := Copy( S, 1, k-1 );
//Showmessage( stemp + "; that copy; r=" + IntToStr(r) + "; c=" + IntToStr(c) );
//Çàíîñèì äàííûå
SArray[r,c] := StrToFloat(stemp);
StringGrid.Rows[r].Strings[c] := stemp;
//óäàëÿåì çàíåñåííîå èç ñòðîêè
Delete(S, 1, k);
inc(c);
//Showmessage( "S = 0" + s );
end;
inc(r);
end;
//Çäåñü çàêðûâàåì ôàéë
CloseFile(f);
end;
end;
← →
Steep
(2008-01-13 20:53)
[1]
Блин! чегото я только отправляю вопрос на форум и меня озаряет :)))))
Здесь же нужно в массиве наоборот указать (или заносить )
SArray: array[0..59, 0..9] of real;
Всем спасибо!
← →
No_Dead ©
(2008-01-13 20:56)
[2]
> if OD.Execute=true then
а это что?
я просто не знаю:(
а так все work, если закомментить указанную
← →
Dmitry S ©
(2008-01-13 20:59)
[3]
OD:TOpenDialog
← →
No_Dead ©
(2008-01-13 21:03)
[4]
> [3] Dmitry S © (13.01.08 20:59)
так принято сокращать? хм, не знал и в правду
← →
Steep
(2008-01-13 21:13)
[5]
> No_Dead ©
может и не принято — но мне так нравится
если он один — то я так сокращаю…..
← →
Amoeba ©
(2008-01-14 03:13)
[6]
И в чем господа, собственно, была проблема то?
← →
KilkennyCat ©
(2008-01-14 04:54)
[7]
> Steep (13.01.08 21:13) [5]
>
>
> > No_Dead ©
>
> может и не принято — но мне так нравится
может, тогда и так понравится, а?
if OD.Execute then
← →
Смирнов
(2008-01-14 08:56)
[8]
> может, тогда и так понравится, а?
>
> if OD.Execute then
еще вариант
if OD.Execute <> false then
← →
KilkennyCat ©
(2008-01-14 09:25)
[9]
if (not OD.execute) = false then — это еще круче
← →
Смирнов
(2008-01-14 10:06)
[10]
if (not OD.execute) = (2 * 2 <> 4) then