Board index » delphi » saving file in .txt format

saving file in .txt format

can anyone help me. I wan to save text in a .txt format. Used by some
texteditors...
--
      Give a smile...Get a smile :)
    *********************************
            Lars Indresaeter       IRC nickname: Larz on Undernet
          Mailto:lindr...@sn.no
       http://home.sn.no/~lindresa/  [Updated: May-18-97]

 

Re:saving file in .txt format


Quote
> can anyone help me. I wan to save text in a .txt format. Used by some
> texteditors...

   Declare a file of type Text, Assign/Rewrite to open it, and use
Writeln to place data on it, followed by Close.  What about this hasn't
worked for you?

Re:saving file in .txt format


On Sat, 26 Jul 1997 01:23:32 +0200, Lars Indresaeter

Quote
<lindr...@online.no> wrote:
>can anyone help me. I wan to save text in a .txt format. Used by some
>texteditors...
>--
>      Give a smile...Get a smile :)
>    *********************************
>            Lars Indresaeter       IRC nickname: Larz on Undernet
>          Mailto:lindr...@sn.no
>       http://home.sn.no/~lindresa/  [Updated: May-18-97]

Not much is easier to do in Borlandish Pascal, this is a toy example,
but illustrates the techniques involved:

program WriteTextFile ;
var
  F : text ;    { file to contain ASCII text }
  S : string ;
begin
  Assign( F, 'SOMEFILE.TXT' ) ;  { associate F with disk file }
  ReWrite( F ) ;                                 { prepare F to write to it }
  S := '' ;
  while S <> 'QUIT' do
  begin
    Write( output, 'Enter a string:' ) ; { prompt user }
    ReadLn( input, S ) ;                             { get string  }
    WriteLn( F, S ) ;                                { send to output file }
  end ;
  Close( F ) ;                   { close file variable }
end .

If this isn't what you're after Email me with some more details of
what you're trying to accomplish and I can go further.

HTH

Stephen Posey
slpo...@concentric.net

Other Threads