Board index » delphi » WriteLn error

WriteLn error

Help! I'm new to Delphi, and programming in general.  I'm starting to
learn about Object Pascal, but every time I use the 'WriteLn' command, I
get an 'EInOutError I/O Err 105' if I use the 16-bit Delphi, 'Err 103' in
the 32-bit version.  
I'm getting frustrated that such a simple command is giving me problems,
but I have no idea how to solve it. Any suggestions?

                                Thanks,
                                 PAN

jebut...@vaxa.weeg.uiowa.edu

 

Re:WriteLn error


Quote
John E. Butler wrote:

> Help! I'm new to Delphi, and programming in general.  I'm starting to
> learn about Object Pascal, but every time I use the 'WriteLn' command, I
> get an 'EInOutError I/O Err 105' if I use the 16-bit Delphi, 'Err 103' in
> the 32-bit version.
> I'm getting frustrated that such a simple command is giving me problems,
> but I have no idea how to solve it. Any suggestions?

>                                 Thanks,
>                                  PAN

> jebut...@vaxa.weeg.uiowa.edu

John,

Is this a CONSOLE App?  If not, then WriteLn is not supported for
Windows (It's there for backwards compaitability to PASCAL and for
CONSOLE Apps under WIN95 and DOS Programs for Win 3.x).  Remember
Windows is a GUI.  Writeln is for a character based systems.  Look up
CONSOLE App if you want a character based program under Windows 95 or
TCanvas Class for a GUI/Windows App in the help. This is for Delphi 2.0.
Delphi 1.0 will compile a DOS Executable if you want then you can use
WriteLn for I/O.  TCanvas is in both 1.0 and 2.0 and for the most part
is an encapsalation of the GDI API.

Hope this helps, Tim.

Re:WriteLn error


John E. Butler (jebut...@blue.weeg.uiowa.edu) wrote

Quote
> every time I use the 'WriteLn' command, I get an 'EInOutError
> I/O Err 105' if I use the 16-bit Delphi, 'Err 103' in the 32-bit
> version.  ...

Delphi16 -- Add "WinCrt" to your uses clause .  
Delphi32 -- Look at "Project -> Options -> Linker -> Generate console
            application."

Re:WriteLn error


"John E. Butler" <jebut...@blue.weeg.uiowa.edu> wrote:

Quote
>Help! I'm new to Delphi, and programming in general.  I'm starting to
>learn about Object Pascal, but every time I use the 'WriteLn' command, I
>get an 'EInOutError I/O Err 105' if I use the 16-bit Delphi, 'Err 103' in
>the 32-bit version.  
>I'm getting frustrated that such a simple command is giving me problems,
>but I have no idea how to solve it. Any suggestions?

Did you use WinCRT in the Uses part of your program? If not, try it.

Hope it Helps
  Rainer

Re:WriteLn error


Help! I'm new to Delphi, and programming in general.  I'm starting to
learn about Object Pascal, but every time I use the 'WriteLn'
command, I get an 'EInOutError I/O Err 105' if I use the 16-bit
Delphi, 'Err 103' in the 32-bit version.  
I'm getting frustrated that such a simple command is giving me
problems, but I have no idea how to solve it. Any suggestions?

Send us a sample of your source code and we should be able to tell you
your error straight away.
2 things first though make sure you use AssignFile() and
FileReset() so that the file is open for writing to.

HTH
Tim Hyder

Re:WriteLn error


Heres some source that might help you

Var
     fSaveFile      :TextFile;
     sTextData      :String;
Begin
          sTextData := 'Write me';      
          AssignFile (fSaveFile,Advertise_File);
          Rewrite (fSaveFile);
          WriteLn (fSaveFile,sTextData);
          CloseFile (fSaveFile);

End;

Your right, it was frustrating.  The key was the TextFile constant.  It
took forever to find.

Re:WriteLn error


 TH> Help! I'm new to Delphi, and programming in general.  I'm starting to
 TH> learn about Object Pascal, but every time I use the 'WriteLn'
 TH> command, I get an 'EInOutError I/O Err 105' if I use the 16-bit
 TH> Delphi, 'Err 103' in the 32-bit version.

I'm only a little more experienced with Delphi, but the problem
is that writeln only works in a console-mode program.  You can
set a compiler option to get console mode.  Then you can use
writeln, but it writes plain gray text on a black background and
scrolls, 1970's style.  Text mode is missing from Delphi - they
want you to use the Windows stuff.

Jud McCranie  jud.mccra...@swsbbs.com

 * Silver Xpress V4.3 SW20178

Re:WriteLn error


On Thu, 13 Jun 96 13:57:00 -0500, jud.mccra...@swsbbs.com (JUD

Quote
MCCRANIE) wrote:
>  Then you can use
>writeln, but it writes plain gray text on a black background and
>scrolls, 1970's style.  Text mode is missing from Delphi - they
>want you to use the Windows stuff.

You can get colours in the old fashioned way using Ansi graphics
commands, just like in the 80's.  (You might have to explicitly load
ansi.sys.)  I don't think there's any unit like TP's CRT, but it is
probably not too hard to write one.

Duncan Murdoch

Re:WriteLn error


On Fri, 14 Jun 1996 01:32:14 GMT, dmurd...@mast.queensu.ca (Duncan

Quote
Murdoch) wrote:
>On Thu, 13 Jun 96 13:57:00 -0500, jud.mccra...@swsbbs.com (JUD
>MCCRANIE) wrote:
>>  Then you can use
>>writeln, but it writes plain gray text on a black background and
>>scrolls, 1970's style.  Text mode is missing from Delphi - they
>>want you to use the Windows stuff.

>You can get colours in the old fashioned way using Ansi graphics
>commands, just like in the 80's.  (You might have to explicitly load
>ansi.sys.)  I don't think there's any unit like TP's CRT, but it is
>probably not too hard to write one.

Perhaps TConsole (I think it's console.zip) on the Delphi Super Page
http://sunsite.icm.edu.pl/~robert/delphi/ or one of its mirrors might
make life at bit easier...

It basically is a text mode component for D1 + D2.
--
Stefan Hoffmeister                       Stefan.Hoffmeis...@Uni-Passau.de
University of Passau, Bavaria, Germany   http://www.rz.uni-passau.de/~w4hoff01/

Re:WriteLn error


 TH> Help! I'm new to Delphi, and programming in general.  I'm starting to
 TH> learn about Object Pascal, but every time I use the 'WriteLn'
 TH> command, I get an 'EInOutError I/O Err 105' if I use the 16-bit
 TH> Delphi, 'Err 103' in the 32-bit version.

When using the text file function WRITELN you need to precede it
with a call to  APPEND which opens (or creates) the file for output.

See the help files for parameters.

redman

Other Threads