Latest versions
Menu  Language: fr

Articles & Documents

Close Tutorials


Connect again

Your name (or pseudo) :

Your secret code (associated with your pseudo)

 Count of members 417 members

Connected :


Friends News
Google Ads
To receive news about this website, consider subscribing to our Newsletter.
24 Subscribers
Webmaster - Infos


   visitors online

forum.gifForum - ppCompiler [EN] - Topic #6

Forum - Forum
ppCompiler [EN] - ppCompiler [EN]

active  Topic # 6  saving text files

08/02/2009 @ 17:56
by simoninmarch



I seem to be having difficulty saving a text file, and was wondering if it might be a problem with my Tungsten Tx, or simply me missing something.

When I try the following code, I find that only the first word is saved to the text file:

   f : file of string;

   rewrite(f, 'myfile.txt');
   write(f, 'hello ', 'this ', 'is', 'me.');

I have also tried using

f^ := 'hello;

... and so on with 'this', 'is', 'me', but still only the first word is written to the text file. However, if I concatenate the strings, and use write(f, 'hello ' + 'this ' + 'is ' + 'me'), all of the words are written. It seems that only the first reference to a file of string is written.

I was going to try and close the file and then open and append the 2nd, 3rd and 4th words, but pp does not seem to support the append command. My second question, then, is how can I append text to a file?

Thank you.

Write to simoninmarch   Post an answer  Top
Answer n° 1
08/02/2009 @ 21:08
by Philippe


All the strings are written on the file by the program, not only the first one, but it cannot be read with a standard doc reader.
A string is a constant block of 64 characters. You can check how it is written with Bird by openning the "MiFile.txt" database.
The file can be opended for inspection (reset) and you can read all the strings that have been written in another Pascal program.
This file feature has been implemented for compatiblity with the ISO standard. If you want doc files that can be opended with doc reader, I advice to use the PalmOS API. You can have a look on the source code of Piaf for example.
Write to Philippe   Post an answer  Top
Answer n° 2
08/02/2009 @ 22:45
by simoninmarch


Thank you Philippe - that's helpful.e
Write to simoninmarch   Post an answer  Top
active topic active   closed topic closed   Sticky Sticky   New New message   -   Correct Correct message   Close Close topic   Make sticky Make sticky
Forum Topic  Forum 

^ Top ^