Articles & Documents

Fermer Tutoriaux

Lettre d'information
Pour avoir des nouvelles de ce site, inscrivez-vous à notre Newsletter.
Se désabonner
22 Abonnés

Nouvelles des Amis


   visiteurs en ligne

Webmaster - Infos
forum.gifForum - ppCompiler - Sujet n°6

Forum - Forum
ppCompiler - ppCompiler

actif  Sujet n° 6  saving text files

le 08/02/2009 @ 17:56
par 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.

Ecrire à simoninmarch   Poster une réponse  Haut
Réponse n° 1
le 08/02/2009 @ 21:08
par 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.
Ecrire à Philippe   Poster une réponse  Haut
Réponse n° 2
le 08/02/2009 @ 22:45
par simoninmarch


Thank you Philippe - that's helpful.e
Ecrire à simoninmarch   Poster une réponse  Haut
actif sujet actif   clos sujet clos   Important! Important!   Nouveau Nouveau message   -   Rectifier Rectifier message   Clôturer Clôturer sujet   Remonter Remonter
Catégories de discussion  Forum 

^ Haut ^