🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.pascal
Article #92793

Re: EAccessViolation : Access violation

#92793
From: Andrzej Grażyński
Date: Thu, 01 Oct 2009 19:37
69 lines
2516 bytes
notaras pisze:
> Kod:
> 
> program nos_text_mode;
> 
> 
> uses
> nos_types,crt,SysUtils;
> 
> var
> f:file of TConfig; //plik z danymi
> temp:TConfig;  //zmienna pomocnicza
> temp_boolean:boolean;
> temp_char:char;
> f2:longint;
> 
> 
> 
> BEGIN
> if FileExists('config.dat') then
>   begin
>     assign(f, 'config.dat');
>     reset(f);
>     read(f,temp);
>     close(f);
>     writeln('dane konfiguracyjne pomyslnie wczytane');
>     writeln('aaaaaaaa');
>   end;
>   writeln('bbbbbbbb');
> 
> END.
> 
> Program daje ciekawe wyniki:
> 
> dane konfiguracyjne pomyslnie wczytane
> aaaaaaaa
> bbbbbbbb
> An unhandled exception occurred at $08049761 :
>                                               EAccessViolation :
> Access violation
>   $08049761
>               $080566B5
>                         $080481C2  P$NOS_TEXT_MODE_finalize_implicit,
> of nos_text_mode.pas
>               $080572B2
>                         $08057485
> 
> nos_types zawiera:
> 
> TUser=record
>         id:string;
>       end;
> TConfig=record
>           ftp_user:string;
>           ftp_pass:string;
>           upload_ip:string;
>           download_url:string;
>           user:TUser;
>         end;
> 
> 
> Program kompiluje pod linuxem (ubuntu 8.10) poleceniem:
> ppc386  -gl nos_text_mode.pas
> 
> Co zrobic aby program konczyl sie normalnie?
Długi stringi w TConfig: Zamień ma shortstring albo array [...]of char/ 
Dlugie string to encje lifetime managed, czyli de facto pointery do 
instancji. ZApisujesz i czytasz pointery, a nie instancje i to jest 
przyczyna.
Technical Details
Message-ID: <ha30e4$f29$2@news.onet.pl>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.rmf.pl!agh.edu.pl!news.agh.edu.pl!news.onet.pl!not-for-mail
References: <6c39f892-946c-47a0-b7a0-d0e30f3d72d5@z6g2000pre.googlegroups.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.rmf.pl!agh.edu.pl!news.agh.edu.pl!news.onet.pl!not-for-mail
From: Andrzej Grażyński <grazynsk@petex.com.pl>
Newsgroups: pl.comp.lang.pascal
Subject: Re: EAccessViolation : Access violation
Date: Thu, 01 Oct 2009 21:37:41 +0200
Organization: http://onet.pl
Lines: 69
Message-ID: <ha30e4$f29$2@news.onet.pl>
References: <6c39f892-946c-47a0-b7a0-d0e30f3d72d5@z6g2000pre.googlegroups.com>
NNTP-Posting-Host: nat137-88.izacom.pl
Mime-Version: 1.0
X-Trace: news.onet.pl 1254425861 15433 194.149.88.137 (1 Oct 2009 19:37:41 GMT)
X-Complaints-To: niusy@onet.pl
NNTP-Posting-Date: Thu, 1 Oct 2009 19:37:41 +0000 (UTC)
User-Agent: Thunderbird 2.0.0.23 (Windows/20090812)
In-Reply-To: <6c39f892-946c-47a0-b7a0-d0e30f3d72d5@z6g2000pre.googlegroups.com>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit