Freepascal run-time error 
Author Message
 Freepascal run-time error

Hi
I'm running the following code:
  write('Enter full filename to be processed: ');
  readln(SearchString);
  logfilename := 'c:\asncdrlog.txt';
  assign(Logfile,logfilename);
  {$I-} rewrite(Logfile); {$I+}
  if IOresult = 0 then
  begin
     writeln(Logfile,'Opened log');
  end

When it attempts to write to Logfile, I get the message:
An unhandled exception occured at 0x0044E7:
Unknown run-time error : 104

Any idea what is wrong?
Thanks
Neil



Mon, 28 Mar 2005 03:46:02 GMT  
 Freepascal run-time error



Quote:
> Hi
> I'm running the following code:
>   write('Enter full filename to be processed: ');
>   readln(SearchString);
>   logfilename := 'c:\asncdrlog.txt';
>   assign(Logfile,logfilename);
>   {$I-} rewrite(Logfile); {$I+}
>   if IOresult = 0 then
>   begin
>      writeln(Logfile,'Opened log');
>   end

> When it attempts to write to Logfile, I get the message:
> An unhandled exception occured at 0x0044E7:
> Unknown run-time error : 104

> Any idea what is wrong?
> Thanks
> Neil

I'm not too familiar with freePascal, but if you are running in DOS mode
the problem may be that dos does not support long filenames.   asncdrlog
contains 9 letters where the max is 8.

Femme



Mon, 28 Mar 2005 09:16:18 GMT  
 Freepascal run-time error

Quote:



> > Hi
> > I'm running the following code:
> >   write('Enter full filename to be processed: ');
> >   readln(SearchString);
> >   logfilename := 'c:\asncdrlog.txt';
> >   assign(Logfile,logfilename);
> >   {$I-} rewrite(Logfile); {$I+}
> >   if IOresult = 0 then
> >   begin
> >      writeln(Logfile,'Opened log');
> >   end

> > When it attempts to write to Logfile, I get the message:
> > An unhandled exception occured at 0x0044E7:
> > Unknown run-time error : 104

> > Any idea what is wrong?
> > Thanks
> > Neil

> I'm not too familiar with freepascal, but if you are running in DOS mode
> the problem may be that dos does not support long filenames.   asncdrlog
> contains 9 letters where the max is 8.

> Femme

I tried that but still get the same error. I think error 104 is that
the file is not open but I use rewrite to get to the start of the file
- any ideas?


Mon, 28 Mar 2005 20:02:31 GMT  
 Freepascal run-time error
Quote:

> Any idea what is wrong?
> Thanks
> Neil

Your code works without runtime error on my comp

var logfilename:string;
logfile:text;
SearchString:string;
begin
          write('Enter full filename to be processed: ');
   readln(SearchString);
    logfilename := 'c:\asncdrlog.txt';
    assign(Logfile,logfilename);
    {$I-} rewrite(Logfile); {$I+}
    if IOresult = 0 then
    begin
      writeln(Logfile,'Opened log');
    end;
    close(logfile);
end.

--
GG:2510014 http://ucho.prv.pl/ ucho3000[at]poczta.onet.pl
Now Playing: Nightwish - Wishmaster
In this world of a million religions everyone prays the same way
                                       Nightwish "The Kinslayer"



Mon, 28 Mar 2005 18:44:59 GMT  
 Freepascal run-time error

Quote:




> > > Hi
> > > I'm running the following code:
> > >   write('Enter full filename to be processed: ');
> > >   readln(SearchString);
> > >   logfilename := 'c:\asncdrlog.txt';
> > >   assign(Logfile,logfilename);
> > >   {$I-} rewrite(Logfile); {$I+}
> > >   if IOresult = 0 then
> > >   begin
> > >      writeln(Logfile,'Opened log');
> > >   end

> > > When it attempts to write to Logfile, I get the message:
> > > An unhandled exception occured at 0x0044E7:
> > > Unknown run-time error : 104

> > > Any idea what is wrong?
> > > Thanks
> > > Neil

> > I'm not too familiar with freepascal, but if you are running in DOS mode
> > the problem may be that dos does not support long filenames.   asncdrlog
> > contains 9 letters where the max is 8.

> > Femme

> I tried that but still get the same error. I think error 104 is that
> the file is not open but I use rewrite to get to the start of the file
> - any ideas?

this works fine for me -
using the fpc - giving the long file name
and using the bpc - giving only the 8 character file name (asncdrlo.txt)

program test;

var logfile : text;
    logfilename : string;
    searchstring : string;

begin

write('Enter full filename to be processed: ');
readln(searchstring);

logfilename := 'c:\asncdrlog.txt';
assign(logfile,logfilename);
{$I-} rewrite(logfile); {$I+}

if IOresult = 0 then
  begin
  writeln(logfile,'Opened log');
  end;

close(logfile);

end.



Mon, 28 Mar 2005 21:30:24 GMT  
 Freepascal run-time error

Quote:


>> the file is not open but I use rewrite to get to the start of the file
>> - any ideas?

> this works fine for me -
> using the fpc - giving the long file name
> and using the bpc - giving only the 8 character file name (asncdrlo.txt)

It should work, OP should provide more details, specially uses clause and
compiler mode.


Mon, 28 Mar 2005 23:35:27 GMT  
 Freepascal run-time error

Quote:


> > Any idea what is wrong?
> > Thanks
> > Neil
> Your code works without runtime error on my comp

> var logfilename:string;
> logfile:text;
> SearchString:string;
> begin
>           write('Enter full filename to be processed: ');
>    readln(SearchString);
>     logfilename := 'c:\asncdrlog.txt';
>     assign(Logfile,logfilename);
>     {$I-} rewrite(Logfile); {$I+}
>     if IOresult = 0 then
>     begin
>       writeln(Logfile,'Opened log');
>     end;
>     close(logfile);
> end.

Thanks guys - the file I was trying to write to was corrupt


Tue, 29 Mar 2005 03:59:41 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Run time error 200...all the time

2. Error 100 : Disk read error (Run-Time)

3. Error 100 : Disk read error (Run-Time)

4. New run-time error at 500Mhz

5. Avoid run-time error 106 and the like?

6. Run-time error question

7. run time error when compiled

8. run time 200 errors

9. Run-time error 200

10. Run-time error 204???????

11. Run time Error 200

12. CRT Run Time Error 200

 

 
Powered by phpBB® Forum Software