Search
Articles & Documents
Tutorials
Newsletter
CPDB.Net
Friends News
Visits
Webmaster - Infos
|
- Forum
- ppCompiler
Topic # 6 |
saving text files |
08/02/2009 @ 17:56 by simoninmarch

|
Hi
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:
var f : file of string;
begin rewrite(f, 'myfile.txt'); write(f, 'hello ', 'this ', 'is', 'me.'); close(f) end.
I have also tried using
f^ := 'hello; put(f);
... 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.
Simon. |
|
|
Answer n° 1 -------- 08/02/2009 @ 21:08 by Philippe

visitor |
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. |
|
 |
Answer n° 2 -------- 08/02/2009 @ 22:45 by simoninmarch

visitor |
Thank you Philippe - that's helpful. |
|
 |
 topic active
 topic closed
 Sticky
 New message -
 Correct message
 Close topic
 Make sticky
|