The original TP file record consists of 3 types: integer, real and byte, I replaced the original integer with smallint, but it still doesn't work and the result I get is even worse. Sorry for bothering again, thanx
----- PŮVODNÍ ZPRÁVA ----- Od: "Prof A Olowofoyeku (The African Chief)" chiefsoft@bigfoot.com Komu: xstang@post.cz Předmět: Re: Dev+GNU Pascal Datum: 8.12.2005 - 15:54:56
On 8 Dec 2005 at 14:43, xstang@post.cz wrote:
I have one more question: do you have any experiences with reading old TP binary files? I try to read one and rewrite it to text file, but it's not done correctly. Thanx
Same way as you read and write them with TP - except that the sizes of data types are often different in GPC, and therefore you might need to specify more particularly the size of the data types that you use e.g., "word" and "integer" are 16-bit in TP but 32-bit in GPC, and strings are implemented as schema in GPC - so any record containing strings is going to have a different size. See \dev_gpc\units\winapi\wintypes.pas to see how to declare integers and words with specific sizes in GPC.
PS: general questions like this should go to the GPC list. The question about the IDE is about a specific tool that I am maintaining for a specific platform (Windows) and that is of no general interest to many of the people on the GPC list.
Best regards, The Chief
Prof. Abimbola A. Olowofoyeku (The African Chief) web: http://www.greatchief.plus.com/
On 8 Dec 2005 at 16:53, xstang@post.cz wrote:
The original TP file record consists of 3 types: integer, real and byte, I replaced the original integer with smallint, but it still doesn't work and the result I get is even worse. Sorry for bothering again, thanx
I think the problem will be with the Real. Change it to "BPReal", and add "System" to your USES clause.
Best regards, The Chief -------- Prof. Abimbola A. Olowofoyeku (The African Chief) web: http://www.greatchief.plus.com/
but then it doesn't allow me to write variable of BPreal type to text file, I get
dev_gpc!moje\pl_tp.pas:77: argument to `Write' is of wrong type
neither convert it to string using str function, I get
dev_gpc!moje\pracovni_listky.pas:74: called object is not a procedure or function
strange thing is, that I don't get this message with the first str function.
Thanx Xstng
----- PŮVODNÍ ZPRÁVA ----- Od: "Prof A Olowofoyeku (The African Chief)" chiefsoft@bigfoot.com Komu: gpc@gnu.de Předmět: Re: Dev+GNU Pascal Datum: 8.12.2005 - 18:35:04
On 8 Dec 2005 at 16:53, xstang@post.cz wrote:
The original TP file record consists of 3 types: integer, real and byte, I replaced the original integer with smallint, but it still doesn't work and the result I get is even worse. Sorry for bothering again, thanx
I think the problem will be with the Real. Change it to "BPReal", and add "System" to your USES clause.
Best regards, The Chief
Prof. Abimbola A. Olowofoyeku (The African Chief) web: http://www.greatchief.plus.com/
On 9 Dec 2005 at 9:45, xstang@post.cz wrote:
but then it doesn't allow me to write variable of BPreal type to text file, I get
dev_gpc!moje\pl_tp.pas:77: argument to `Write' is of wrong type
[...]
It is not that straightforward. "BPReal" is declared as a packed record, containing a packed array of 6 bytes, and you need to use conversion routines to and from "BPReal" to GPC's "Real":
RealToBPReal BPRealToReal
See the source code of the GPC system unit for further information.
Best regards, The Chief -------- Prof. Abimbola A. Olowofoyeku (The African Chief) web: http://www.greatchief.plus.com/