Run error 103 lazarus

Ошибка 103 при попытке чтения файла Lazarus Решение и ответ на вопрос 2003446

El petyx

0 / 0 / 0

Регистрация: 24.05.2017

Сообщений: 4

1

14.06.2017, 13:52. Показов 9260. Ответов 3

Метки нет (Все метки)


Здравствуйте. После попытки чтения выдается ошибка runerror 103. Что нужно исправить?

Pascal
1
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
procedure TForm1.Button3Click(Sender: TObject);
var
f:file;
s:file;
i,j,p:integer;
begin
Assignfile(f,'source.dat');
ReWrite(f,1);
for i:=1 to stringgrid1.RowCount do
 for j:=1 to stringgrid1.ColCount do
 begin
 p:=strtoint(stringgrid1.cells[j-1,i-1]);
 blockwrite(f,p,sizeof(p));
end;
CloseFile(f);
AssignFile(s,'size.dat');
ReWrite(s,1);
blockwrite(s,stringgrid1.RowCount,sizeof(stringgrid1.RowCount));
blockwrite(s,stringgrid1.ColCount,sizeof(stringgrid1.ColCount));
CloseFile(s);
end;
 
procedure TForm1.Button4Click(Sender: TObject);
var
f:file;
s:file;
i,j,p,y:integer;
si: array [1..2] of integer;
begin
AssignFile(s,'size.dat');
Reset(s,1);
for i:=1 to 2 do begin
    BlockRead(f,p,sizeof(p));
    si[i]:=p;
    end;
CloseFile(s);
StringGrid2.RowCount:=si[1];
StringGrid2.ColCount:=si[2];
 
AssignFile(f,'source.dat');
Reset(f,1);
 
{while not Eof(f) do
begin
   for i:=1 to StringGrid2.RowCount do
            for j:=1 to StringGrid2.ColCount do
                begin
                   BlockRead(f,p,sizeof(p));
                   StringGrid2.Cells[i-1,j-1]:=IntToStr(p);
                end;  
CloseFile(f);
end;
end;

__________________
Помощь в написании контрольных, курсовых и дипломных работ, диссертаций здесь



0



Супер-модератор

Эксперт Pascal/DelphiАвтор FAQ

32451 / 20945 / 8105

Регистрация: 22.10.2011

Сообщений: 36,213

Записей в блоге: 7

14.06.2017, 14:41

2

Открываешь файл через переменную s (31-я строка), а читаешь через переменную f (33-я строка). Издержки копи-пасты?



0



El petyx

0 / 0 / 0

Регистрация: 24.05.2017

Сообщений: 4

15.06.2017, 07:39

 [ТС]

3

Не, издержки криворукости. Вот, подправил, но ошибка (103) таже появляется, а именно в строке 43

Pascal
1
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
procedure TForm1.Button3Click(Sender: TObject);
var
f:file;
s:file;
i,j,p:integer;
begin
Assignfile(f,'source.dat');
ReWrite(f,1);
for i:=1 to stringgrid1.RowCount do
 for j:=1 to stringgrid1.ColCount do
 begin
 p:=strtoint(stringgrid1.cells[j-1,i-1]);
 blockwrite(f,p,sizeof(p));
end;
CloseFile(f);
AssignFile(s,'size.dat');
ReWrite(s,1);
blockwrite(s,stringgrid1.RowCount,sizeof(stringgrid1.RowCount));
blockwrite(s,stringgrid1.ColCount,sizeof(stringgrid1.ColCount));
CloseFile(s);
end;
 
procedure TForm1.Button4Click(Sender: TObject);
var
f:file;
s:file;
i,j,p,y:integer;
si: array [1..2] of integer;
begin
AssignFile(s,'size.dat');
Reset(s,1);
for i:=1 to 2 do begin
    BlockRead(s,p,sizeof(p));
    si[i]:=p;
    end;
CloseFile(s);
StringGrid2.RowCount:=si[1];
StringGrid2.ColCount:=si[2];
 
AssignFile(f,'source.dat');
Reset(f,1);
 
while not Eof(f) do
begin
   for i:=1 to StringGrid2.ColCount do
            for j:=1 to StringGrid2.RowCount do
                begin
                   BlockRead(f,p,sizeof(p));
                   StringGrid2.Cells[i-1,j-1]:=IntToStr(p);
                end;
CloseFile(f);
end;
end;



0



volvo

Супер-модератор

Эксперт Pascal/DelphiАвтор FAQ

32451 / 20945 / 8105

Регистрация: 22.10.2011

Сообщений: 36,213

Записей в блоге: 7

15.06.2017, 09:22

4

Лучший ответ Сообщение было отмечено volvo как решение

Решение

Цикл while не нужен, из файла и так прочитается столько значений, сколько туда было записано:

Pascal
1
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
procedure TForm1.Button4Click(Sender: TObject);
var
  f: file;
  s: file;
  i, j, p, y: integer;
  si: array [1..2] of integer;
begin
  AssignFile(s, 'size.dat');
  Reset(s, 1);
  for i := 1 to 2 do
  begin
    BlockRead(s, p, sizeof(p));
    si[i] := p;
  end;
  CloseFile(s);
  StringGrid2.RowCount := si[1];
  StringGrid2.ColCount := si[2];
 
  AssignFile(f, 'source.dat');
  Reset(f, 1);
 
  //while not EOF(f) do
  //begin
    for i := 1 to StringGrid2.ColCount do
      for j := 1 to StringGrid2.RowCount do
      begin
        BlockRead(f, p, sizeof(p));
        StringGrid2.Cells[i - 1, j - 1] := IntToStr(p);
      end;
    CloseFile(f);
  //end;
end;

P.S. Ты в курсе, что в StringGrid будет транспонированная относительно StringGrid1 матрица?



0



Модератор: Модераторы

класс исключения runError(103

прошу помогите я на писал программу но при работе lazarus мне выдал ошибку класс исключения runError(103) что это может быть и как это исправить
заранее спасибо

lymar
незнакомец
 
Сообщения: 3
Зарегистрирован: 19.02.2012 14:28:22

Re: класс исключения runError(103

Сообщение iskander » 19.02.2012 15:12:14

FPC User’s Guide, Appendix D-Run-time errors:


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.

iskander
энтузиаст
 
Сообщения: 537
Зарегистрирован: 08.01.2012 18:43:34


Re: класс исключения runError(103

Сообщение lymar » 19.02.2012 15:20:14

FPC User’s Guide, Appendix D-Run-time errors:

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.
а можно по русский а то я в этом деле новичок позжалуйста

Добавлено спустя 6 минут 5 секунд:
windows xp fps 2.4.2
программа

Код: Выделить всё
unit Unit1;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls;

type

  { TForm1 }

  TForm1 = class(TForm)
    Button1: TButton;
    Edit1: TEdit;
    Edit2: TEdit;
    Edit3: TEdit;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    procedure Button1Click(Sender: TObject);
  private
    { private declarations }
  public
    { public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.lfm}

{ TForm1 }

procedure TForm1.Button1Click(Sender: TObject);
procedure korni(a,b,c:real;var x1,x2:real;var pr:boolean);
var d:real;
begin
d:=b*b-4*a*c;
if d<0 then
    pr:=false
else
   begin
     pr:=true;
     x1:=(-b+sqrt(d))/2*a;
     x2:=(-b-sqrt(d))/2*a;
   end;
end;
var a_,b_,c_,x_,x1_,x2_:real; pr_:boolean;
begin
  writeln('a_:=');
  readln(a_);
  write('b_:=');
  readln(b_);
  write('c_:=');
  readln(c_);
  if a_=0 then
  begin
    if b_<>0 then
     begin
       x_:=-c_/b_;
       writeln('x= ',x_);
       end
    else
    writeln('нет коней');
    end
  else
  begin
    korni(A_,B_,C_,X1_,X2_,PR_);
    if pr_=false then
     writeln('нет корней')
     else
       writeln('x1=',x1_ ,'x2=',x2_);
     end;
end;
end.

.

Добавлено спустя 3 минуты 40 секунд:
дело в том что сама программа запускается а вот работать не хочет
прикладываю кусок с ошибкой:
writeln(‘a_:=’); вот здесь ошибка выделена серым цветом вся строка
readln(a_);
write(‘b_:=’);
readln(b_);
write(‘c_:=’);
readln(c_);
if a_=0 then
begin
if b_<>0 then

lymar
незнакомец
 
Сообщения: 3
Зарегистрирован: 19.02.2012 14:28:22

Re: класс исключения runError(103

Сообщение Little_Roo » 19.02.2012 15:44:15

lymar писал(а):программа
unit Unit1;

Пользуйтесь тегом Code
И потом, как в процедуре два var ?

И «Как, Холмс ?» можно в оконнную процедуру впихать консольную ???? :shock:
Подозрение, что сработал метод тупого копи-паста…
Или уж консольная программа — write-read — или оконное приложение — тогда используйте TEdit-TLabel

А в данном примере :) — ввод-вывод из несуществующей консоли — вот и 103 ошибка — не понятно, откуда читать, куда писать…

Последний раз редактировалось Little_Roo 19.02.2012 16:26:50, всего редактировалось 1 раз.

Аватара пользователя
Little_Roo
энтузиаст
 
Сообщения: 632
Зарегистрирован: 27.02.2009 19:56:36
Откуда: Санкт-Петербург


Re: класс исключения runError(103

Сообщение lymar » 19.02.2012 17:23:09

огромное спасибо

lymar
незнакомец
 
Сообщения: 3
Зарегистрирован: 19.02.2012 14:28:22


Вернуться в Lazarus

Кто сейчас на конференции

Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 16

Содержание

  1. Lazarus runtime error 103
  2. Re: класс исключения runError(103
  3. Re: класс исключения runError(103
  4. Re: класс исключения runError(103
  5. Re: класс исключения runError(103
  6. Lazarus runtime error 103
  7. Re: Error 103
  8. Re: Error 103
  9. Re: Error 103
  10. Lazarus runtime error 103
  11. Re: класс исключения runError(103
  12. Re: класс исключения runError(103
  13. Re: класс исключения runError(103
  14. Re: класс исключения runError(103
  15. Lazarus runtime error 103
  16. Re: класс исключения runError(103
  17. Re: класс исключения runError(103
  18. Re: класс исключения runError(103
  19. Re: класс исключения runError(103
  20. Lazarus runtime error 103
  21. Re: класс исключения runError(103
  22. Re: класс исключения runError(103
  23. Re: класс исключения runError(103
  24. Re: класс исключения runError(103

Lazarus runtime error 103

lymar » 19.02.2012 14:36:47

Re: класс исключения runError(103

iskander » 19.02.2012 15:12:14

Re: класс исключения runError(103

Little_Roo » 19.02.2012 15:16:16

И лучше указывать ТТХ — версию ОС, лазаря, fpc и хоть кусок программы, где вызывается исключение

Re: класс исключения runError(103

lymar » 19.02.2012 15:20:14

FPC User’s Guide, Appendix D-Run-time errors:
.
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.
а можно по русский а то я в этом деле новичок позжалуйста

Добавлено спустя 6 минут 5 секунд:
windows xp fps 2.4.2
программа
Код: Выделить всё unit Unit1;

uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls;

TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
procedure Button1Click(Sender: TObject);
private
< private declarations >
public
< public declarations >
end;

var
Form1: TForm1;

procedure TForm1.Button1Click(Sender: TObject);
procedure korni(a,b,c:real;var x1,x2:real;var pr:boolean);
var d:real;
begin
d:=b*b-4*a*c;
if d 0 then
begin
x_:=-c_/b_;
writeln(‘x= ‘,x_);
end
else
writeln(‘нет коней’);
end
else
begin
korni(A_,B_,C_,X1_,X2_,PR_);
if pr_=false then
writeln(‘нет корней’)
else
writeln(‘x1=’,x1_ ,’x2=’,x2_);
end;
end;
end. .

Добавлено спустя 3 минуты 40 секунд:
дело в том что сама программа запускается а вот работать не хочет
прикладываю кусок с ошибкой:
writeln(‘a_:=’); вот здесь ошибка выделена серым цветом вся строка
readln(a_);
write(‘b_:=’);
readln(b_);
write(‘c_:=’);
readln(c_);
if a_=0 then
begin
if b_<>0 then

Re: класс исключения runError(103

Little_Roo » 19.02.2012 15:44:15

Пользуйтесь тегом Code
И потом, как в процедуре два var ?

И «Как, Холмс ?» можно в оконнную процедуру впихать консольную .
Подозрение, что сработал метод тупого копи-паста.
Или уж консольная программа — write-read — или оконное приложение — тогда используйте TEdit-TLabel

А в данном примере — ввод-вывод из несуществующей консоли — вот и 103 ошибка — не понятно, откуда читать, куда писать.

Источник

Lazarus runtime error 103

Mavlyudov » 12.12.2011 03:20:21

После компилирования при запуске возникает ошибка:
Runtime error 103 at
В программе нету работы с файлами.
Есть только обращение к таким процедурам
WRITEln(‘N=’);
READLN(N);
READLN;
В ошибке указан номер строчки , которой соответствует WRITEln(‘N=’);

Компилирую из командной строки(.bat фай) такого содержания
fpWbinwin32ppc386 -Sd -Sg -Un -O1 -Xs -gl %1
Компилятор версии 1.0.10 [2003/06/27].
Также пробовал версию 2.4.4 [2011/04/23]. При компилировании из командной строки ошибка таже самая,
а вот при компилировании из-под оболочки fp.exe всё компилируется и запускается без ошибок.

В чем может быт причина возникновения такой ошибки 103 и как ее устранить?

Re: Error 103

Сквозняк » 12.12.2011 04:48:52

Re: Error 103

Sergei I. Gorelkin » 12.12.2011 08:45:06

Re: Error 103

Mavlyudov » 13.12.2011 03:12:11

Сквозняк
Я предполагал, что fpc (или fp) использует ppc386 при компиляции, поэтому искал файл настроек с директивами, которые можно прописать и в командной строке. Как оказалось, fp и ppc386 — два независимых приложения.
Sergei I. Gorelkin
Видимо, речь все таки идет о ключе ключе -WС. Да, теперь компилируется.
Но при компиляции компилером версии 1.0.10 возникла другая ошибка 203. Переполнение кучи.
Runtime error 203 at адрес
и еще несколько адресов ниже
указана строка с кодом GetMem(ARRM[I], sizeof(ARRM[I]^));
При использовании компилятора версии 2.4.4 такой ошибки не возникает. Но нужно разобраться именно с ошибкой компилятора более ранней версии.
Компилирую как и раньше командной строкой через ppc386.
Настройки .bat файла:
FPC2.4.4bini386-win32ppc386 -Sd -Sg -Un -O1 -Xs -gl %1 -FU -Foc: -WC -WN

При запуске программы предполагается ввод большого числа(например, 20000), так чтобы выполнилась часть кода в except.

Код: Выделить всё program Project4;

type
MAS = array [0..NNMAT-1] of Double;
ARR = ^MAS;
MAS2 = array [0..NNARR] of ARR;
PMAS2 = ^MAS2;

var <——————————->
NMAT0, NMAT: INTEGER;
ARRM: array [0..NNARR] of ARR;
ARR0: ARR;
GE:DWORD;

procedure MAT_PRED(N:INTEGER);
var
NN, I: LONGINT;
begin
NN:= SQR(N);
I:= 0;
NMAT:= 0;

Источник

Lazarus runtime error 103

lymar » 19.02.2012 14:36:47

Re: класс исключения runError(103

iskander » 19.02.2012 15:12:14

Re: класс исключения runError(103

Little_Roo » 19.02.2012 15:16:16

И лучше указывать ТТХ — версию ОС, лазаря, fpc и хоть кусок программы, где вызывается исключение

Re: класс исключения runError(103

lymar » 19.02.2012 15:20:14

FPC User’s Guide, Appendix D-Run-time errors:
.
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.
а можно по русский а то я в этом деле новичок позжалуйста

Добавлено спустя 6 минут 5 секунд:
windows xp fps 2.4.2
программа
Код: Выделить всё unit Unit1;

uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls;

TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
procedure Button1Click(Sender: TObject);
private
< private declarations >
public
< public declarations >
end;

var
Form1: TForm1;

procedure TForm1.Button1Click(Sender: TObject);
procedure korni(a,b,c:real;var x1,x2:real;var pr:boolean);
var d:real;
begin
d:=b*b-4*a*c;
if d 0 then
begin
x_:=-c_/b_;
writeln(‘x= ‘,x_);
end
else
writeln(‘нет коней’);
end
else
begin
korni(A_,B_,C_,X1_,X2_,PR_);
if pr_=false then
writeln(‘нет корней’)
else
writeln(‘x1=’,x1_ ,’x2=’,x2_);
end;
end;
end. .

Добавлено спустя 3 минуты 40 секунд:
дело в том что сама программа запускается а вот работать не хочет
прикладываю кусок с ошибкой:
writeln(‘a_:=’); вот здесь ошибка выделена серым цветом вся строка
readln(a_);
write(‘b_:=’);
readln(b_);
write(‘c_:=’);
readln(c_);
if a_=0 then
begin
if b_<>0 then

Re: класс исключения runError(103

Little_Roo » 19.02.2012 15:44:15

Пользуйтесь тегом Code
И потом, как в процедуре два var ?

И «Как, Холмс ?» можно в оконнную процедуру впихать консольную .
Подозрение, что сработал метод тупого копи-паста.
Или уж консольная программа — write-read — или оконное приложение — тогда используйте TEdit-TLabel

А в данном примере — ввод-вывод из несуществующей консоли — вот и 103 ошибка — не понятно, откуда читать, куда писать.

Источник

Lazarus runtime error 103

lymar » 19.02.2012 14:36:47

Re: класс исключения runError(103

iskander » 19.02.2012 15:12:14

Re: класс исключения runError(103

Little_Roo » 19.02.2012 15:16:16

И лучше указывать ТТХ — версию ОС, лазаря, fpc и хоть кусок программы, где вызывается исключение

Re: класс исключения runError(103

lymar » 19.02.2012 15:20:14

FPC User’s Guide, Appendix D-Run-time errors:
.
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.
а можно по русский а то я в этом деле новичок позжалуйста

Добавлено спустя 6 минут 5 секунд:
windows xp fps 2.4.2
программа
Код: Выделить всё unit Unit1;

uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls;

TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
procedure Button1Click(Sender: TObject);
private
< private declarations >
public
< public declarations >
end;

var
Form1: TForm1;

procedure TForm1.Button1Click(Sender: TObject);
procedure korni(a,b,c:real;var x1,x2:real;var pr:boolean);
var d:real;
begin
d:=b*b-4*a*c;
if d 0 then
begin
x_:=-c_/b_;
writeln(‘x= ‘,x_);
end
else
writeln(‘нет коней’);
end
else
begin
korni(A_,B_,C_,X1_,X2_,PR_);
if pr_=false then
writeln(‘нет корней’)
else
writeln(‘x1=’,x1_ ,’x2=’,x2_);
end;
end;
end. .

Добавлено спустя 3 минуты 40 секунд:
дело в том что сама программа запускается а вот работать не хочет
прикладываю кусок с ошибкой:
writeln(‘a_:=’); вот здесь ошибка выделена серым цветом вся строка
readln(a_);
write(‘b_:=’);
readln(b_);
write(‘c_:=’);
readln(c_);
if a_=0 then
begin
if b_<>0 then

Re: класс исключения runError(103

Little_Roo » 19.02.2012 15:44:15

Пользуйтесь тегом Code
И потом, как в процедуре два var ?

И «Как, Холмс ?» можно в оконнную процедуру впихать консольную .
Подозрение, что сработал метод тупого копи-паста.
Или уж консольная программа — write-read — или оконное приложение — тогда используйте TEdit-TLabel

А в данном примере — ввод-вывод из несуществующей консоли — вот и 103 ошибка — не понятно, откуда читать, куда писать.

Источник

Lazarus runtime error 103

lymar » 19.02.2012 14:36:47

Re: класс исключения runError(103

iskander » 19.02.2012 15:12:14

Re: класс исключения runError(103

Little_Roo » 19.02.2012 15:16:16

И лучше указывать ТТХ — версию ОС, лазаря, fpc и хоть кусок программы, где вызывается исключение

Re: класс исключения runError(103

lymar » 19.02.2012 15:20:14

FPC User’s Guide, Appendix D-Run-time errors:
.
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.
а можно по русский а то я в этом деле новичок позжалуйста

Добавлено спустя 6 минут 5 секунд:
windows xp fps 2.4.2
программа
Код: Выделить всё unit Unit1;

uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls;

TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
procedure Button1Click(Sender: TObject);
private
< private declarations >
public
< public declarations >
end;

var
Form1: TForm1;

procedure TForm1.Button1Click(Sender: TObject);
procedure korni(a,b,c:real;var x1,x2:real;var pr:boolean);
var d:real;
begin
d:=b*b-4*a*c;
if d 0 then
begin
x_:=-c_/b_;
writeln(‘x= ‘,x_);
end
else
writeln(‘нет коней’);
end
else
begin
korni(A_,B_,C_,X1_,X2_,PR_);
if pr_=false then
writeln(‘нет корней’)
else
writeln(‘x1=’,x1_ ,’x2=’,x2_);
end;
end;
end. .

Добавлено спустя 3 минуты 40 секунд:
дело в том что сама программа запускается а вот работать не хочет
прикладываю кусок с ошибкой:
writeln(‘a_:=’); вот здесь ошибка выделена серым цветом вся строка
readln(a_);
write(‘b_:=’);
readln(b_);
write(‘c_:=’);
readln(c_);
if a_=0 then
begin
if b_<>0 then

Re: класс исключения runError(103

Little_Roo » 19.02.2012 15:44:15

Пользуйтесь тегом Code
И потом, как в процедуре два var ?

И «Как, Холмс ?» можно в оконнную процедуру впихать консольную .
Подозрение, что сработал метод тупого копи-паста.
Или уж консольная программа — write-read — или оконное приложение — тогда используйте TEdit-TLabel

А в данном примере — ввод-вывод из несуществующей консоли — вот и 103 ошибка — не понятно, откуда читать, куда писать.

Источник

Lazarus runtime error 103

Mavlyudov » 12.12.2011 03:20:21

После компилирования при запуске возникает ошибка:
Runtime error 103 at
В программе нету работы с файлами.
Есть только обращение к таким процедурам
WRITEln(‘N=’);
READLN(N);
READLN;
В ошибке указан номер строчки , которой соответствует WRITEln(‘N=’);

Компилирую из командной строки(.bat фай) такого содержания
fpWbinwin32ppc386 -Sd -Sg -Un -O1 -Xs -gl %1
Компилятор версии 1.0.10 [2003/06/27].
Также пробовал версию 2.4.4 [2011/04/23]. При компилировании из командной строки ошибка таже самая,
а вот при компилировании из-под оболочки fp.exe всё компилируется и запускается без ошибок.

В чем может быт причина возникновения такой ошибки 103 и как ее устранить?

Re: Error 103

Сквозняк » 12.12.2011 04:48:52

Re: Error 103

Sergei I. Gorelkin » 12.12.2011 08:45:06

Re: Error 103

Mavlyudov » 13.12.2011 03:12:11

Сквозняк
Я предполагал, что fpc (или fp) использует ppc386 при компиляции, поэтому искал файл настроек с директивами, которые можно прописать и в командной строке. Как оказалось, fp и ppc386 — два независимых приложения.
Sergei I. Gorelkin
Видимо, речь все таки идет о ключе ключе -WС. Да, теперь компилируется.
Но при компиляции компилером версии 1.0.10 возникла другая ошибка 203. Переполнение кучи.
Runtime error 203 at адрес
и еще несколько адресов ниже
указана строка с кодом GetMem(ARRM[I], sizeof(ARRM[I]^));
При использовании компилятора версии 2.4.4 такой ошибки не возникает. Но нужно разобраться именно с ошибкой компилятора более ранней версии.
Компилирую как и раньше командной строкой через ppc386.
Настройки .bat файла:
FPC2.4.4bini386-win32ppc386 -Sd -Sg -Un -O1 -Xs -gl %1 -FU -Foc: -WC -WN

При запуске программы предполагается ввод большого числа(например, 20000), так чтобы выполнилась часть кода в except.

Код: Выделить всё program Project4;

type
MAS = array [0..NNMAT-1] of Double;
ARR = ^MAS;
MAS2 = array [0..NNARR] of ARR;
PMAS2 = ^MAS2;

var <——————————->
NMAT0, NMAT: INTEGER;
ARRM: array [0..NNARR] of ARR;
ARR0: ARR;
GE:DWORD;

procedure MAT_PRED(N:INTEGER);
var
NN, I: LONGINT;
begin
NN:= SQR(N);
I:= 0;
NMAT:= 0;

Источник

Lazarus runtime error 103

Applications generated by Free Pascal might generate run-time errors when certain abnormal conditions are detected in the application. This appendix lists the possible run-time errors and gives information on why they might be produced. 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:

  • Trying to open for writing a file which is read-only, or which is actually a directory.
  • File is currently locked or used by another process.
  • Trying to create a new file, or directory while a file or directory of the same name already exists.
  • Trying to read from a file which was opened in write-only mode.
  • Trying to write from a file which was opened in read-only mode.
  • Trying to remove a directory or file while it is not possible.
  • No permission to access the file or directory.

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: 1. An array was accessed with an index outside its declared range. 2. Trying to assign a value to a variable outside its range (for instance an enumerated type). 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:

  • if you call Dispose or Freemem with an invalid pointer
  • in case New or GetMem is called, and there is no more memory available. The behavior in this case depends on the setting of ReturnNilIfGrowHeapFails . If it is True , then Nil is returned. if False , then runerror 204 is raised.

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: 1. Dereferencing a nil pointer. 2. Trying to access memory which is out of bounds (for example, calling move with an invalid length). 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).

Источник

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:

  • Trying to open for writing a file which is read-only, or which is actually a directory.
  • File is currently locked or used by another process.
  • Trying to create a new file, or directory while a file or directory of the same name already exists.
  • Trying to read from a file which was opened in write-only mode.
  • Trying to write from a file which was opened in read-only mode.
  • Trying to remove a directory or file while it is not possible.
  • No permission to access the file or directory.
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:

  1. An array was accessed with an index outside its declared range.
  2. Trying to assign a value to a variable outside its range (for instance an enumerated type).
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:

  • if you call Dispose or Freemem with an invalid pointer
  • in case New or GetMem is called, and there is no more memory available. The behavior in this case depends on the setting of ReturnNilIfGrowHeapFails. If it is True, then Nil is returned. if False, then runerror 204 is raised.
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:

  1. Dereferencing a nil pointer.
  2. Trying to access memory which is out of bounds (for example, calling move with an invalid length).
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)

Источник

Adblock
detector

Понравилась статья? Поделить с друзьями:
  • Run time error 5941 microsoft visual basic
  • Run dll устранение ошибки windows 10 не найден указанный модуль
  • Run time error 57121 excel
  • Run apt get update error
  • Rulesengine как устранить ошибку