2009/10/23 JoshyFun :
>
> Since Delphi first streams I had never used pascal "files" anymore,
> they are a lot of restrictive, not thread safe and are very tied to
> which they expect to read/write.
That's kind-of why I wanted to use TFileStream. I use it for reading
binary data, and thought to us
2009/10/23 Aleksa Todorovic :
> constructor Create...;
> procedure WriteStr(const fmt: String; const args: array of const);
> procedure WriteStr(const s: String);
OK, I managed to solve the problem. I have two units that write to the
output text file. The one unit I fixed by using
"AOut.WriteBuff
Zitat von Graeme Geldenhuys :
2009/10/23 Graeme Geldenhuys :
Did you try writing with WriteBuffer(Atext[1], length(AText)?
That works exactly like I intended. Thanks Gerard.
I spoke to soon! :-(
I can view the resulting output.txt file with Midnight Commander
(Linux console file manager)
Hello Frank,
Friday, October 23, 2009, 12:50:22 PM, you wrote:
FP> If you want a text file, why do you not use a variable of type text,
FP> instead of a TFileStream? Text is what writes a text file. I think these
FP> streams are for saving object state, which means they are binary files
TFileStr
On Friday 23 October 2009 11:58:49 Graeme Geldenhuys wrote:
>
> Maybe TFileStream is not suited for plain text output, and I should
> rather use the File type instead?
MSEgui has ttextstream and ttexdatastream, lib/common/kernel/msestream.pas.
http://mseide-msegui.svn.sourceforge.net/viewvc/mseide
On 23/10/2009 11:21, Graeme Geldenhuys wrote:
2009/10/23 Graeme Geldenhuys :
Did you try writing with WriteBuffer(Atext[1], length(AText)?
That works exactly like I intended. Thanks Gerard.
I spoke to soon! :-(
I can view the resulting output.txt file with Midnight Commander
(Linux consol
2009/10/23 Graeme Geldenhuys :
> 2009/10/23 Henry Vermaak :
>>
>> Maybe you need to put the line endings in manually?
>
> What do you mean? I already append LineEnding to AText, and send that
> to WriteAnsiString() call.
That's what I meant (and I just realised you already mentioned it in a
previ
Graeme Geldenhuys schreef:
2009/10/23 Vincent Snijders :
Otherwise you cannot read it back. :-)
But using .WriteAnsiString() doesn't create a plain text file, so the
result is useless.
Is useless for your current use, I admit. Don't use it to create a plain text
file.
But if you want writ
2009/10/23 Henry Vermaak :
>
> Maybe you need to put the line endings in manually?
What do you mean? I already append LineEnding to AText, and send that
to WriteAnsiString() call.
--
Regards,
- Graeme -
___
fpGUI - a cross-platform Free Pascal G
On Fri, Oct 23, 2009 at 12:25, Graeme Geldenhuys
wrote:
>
> Anyway, so now I'm back to square one - unable to create a plain text
> file with TFileStream. :-(
>
What about:
TFileTextStream = class(TFileStream)
constructor Create...;
procedure WriteStr(const fmt: String; const args: array of cons
Graeme Geldenhuys schreef:
2009/10/23 Vincent Snijders :
Otherwise you cannot read it back. :-)
But using .WriteAnsiString() doesn't create a plain text file, so the
result is useless. And as my last post says, the method Gerard
suggested is also not 100%.
It seems extra hard to create a nor
On Fri, Oct 23, 2009 at 12:21 PM, Graeme Geldenhuys
wrote:
> I can view the resulting output.txt file with Midnight Commander
> (Linux console file manager), but if I try and open that file with
> Gnome gEdit or Lazarus IDE, it says the file does not look like a text
> file and refuses to open it
2009/10/23 Graeme Geldenhuys :
> 2009/10/23 Vincent Snijders :
>>
>> Otherwise you cannot read it back. :-)
>
> But using .WriteAnsiString() doesn't create a plain text file, so the
> result is useless. And as my last post says, the method Gerard
> suggested is also not 100%.
>
>
> It seems extra h
2009/10/23 Vincent Snijders :
>
> Otherwise you cannot read it back. :-)
But using .WriteAnsiString() doesn't create a plain text file, so the
result is useless. And as my last post says, the method Gerard
suggested is also not 100%.
It seems extra hard to create a normal, plain, standard text f
2009/10/23 Graeme Geldenhuys :
>
>> Did you try writing with WriteBuffer(Atext[1], length(AText)?
>
> That works exactly like I intended. Thanks Gerard.
I spoke to soon! :-(
I can view the resulting output.txt file with Midnight Commander
(Linux console file manager), but if I try and open that f
Graeme Geldenhuys schreef:
2009/10/23 Gerard N/A :
Could it be that the length indicator bytes of the string are written
to the stream?
Ah, looking at the .WriteAnsiString() implementation, you seem to be
100% correct.
Procedure TStream.WriteAnsiString (const S : String);
Var L : Longint;
2009/10/23 Marco van de Voort :
>
> if length(atext)>0 then
>>WriteBuffer(Atext[1], length(AText)?
I always add a LineEnding character to AText, so the 'if length()'
check is not strictly needed. Sometimes I would like to write a
"blank" line in my text output. Equivalent of writeln('');
--
R
2009/10/23 Gerard N/A :
>
> Could it be that the length indicator bytes of the string are written
> to the stream?
Ah, looking at the .WriteAnsiString() implementation, you seem to be
100% correct.
Procedure TStream.WriteAnsiString (const S : String);
Var L : Longint;
begin
L:=Length(S)
In our previous episode, Gerard N/A said:
> Could it be that the length indicator bytes of the string are written
> to the stream?
I think his result is a shortstring, and that gets binarily written.
> > Maybe TFileStream is not suited for plain text output, and I should
> > rather use the File t
Hi,
On Fri, Oct 23, 2009 at 11:58 AM, Graeme Geldenhuys
wrote:
> where AOut is the TFileStream. But if I view the output file, it
> "mostly" looks like text. Except that on each line in starts with some
> random 2-3 characters.
>
Could it be that the length indicator bytes of the string are wr
Hi,
How do you create plain text file output with TFileStream? Or is
TFileStream reserved for binary output only?
I'm using TFileStream as follows;
// helper function to simply things
procedure writef(AText: string);
begin
AOut.WriteAnsiString(AText + LineEnding);
end;
where AOut is
21 matches
Mail list logo