Board index » delphi » Pascal TEXT FILES and Other Languages

Pascal TEXT FILES and Other Languages

Hi,

This days i hit two problems in my normal programming activities.

First Problem :

     Im writing an application that use a text file written in C++.
In my Delphi3.0  program, I want to open in a shared mode to read
into variables, but i am not able to do that. Both update this file,
although, only one ca do it. ( Semaphore)
     The easier way to open the file for me is Text. Is there any way
to share text files ?

Second Problem :

    If I change to another type of file, what should be the best type
to use ( forget databases ) ? The origiral file is in ascII mode.

Thanks for everyboy.
Doug.

 

Re:Pascal TEXT FILES and Other Languages


Douglas Neves Souza <d...@alternex.com.br>

Quote
>      Im writing an application that use a text file
> written in C++. In my Delphi3.0  program, I want to
> open in a shared mode to read into variables, but i
> am not able to do that. Both update this file, although,
> only one ca do it. ( Semaphore)
> The easier way to open the file for me is Text. Is
> there any way to share text files ?

Text files are a little tricky in Delphi/Pascal, often I find it
easier to treat them as a file of char. The mode thing is done
using the global "FileMode" variable, and the same constants as
C uses will apply (I can't remember them as we use named
constants)

Quote
>     If I change to another type of file, what should
> be the best type to use ( forget databases ) ? The
> origiral file is in ascII mode.

Either a file of record, containing one record. This works if
the data format is fixed, as C can just write the byte stream
as required, then Delphi reads the single record.

If you've got a flexible format then you basically have to read
it as a file of byte in Delphi, much as you do in C.

Moz

--
moz1 at ihug.co.nz
http://homepages.ihug.co.nz/~moz1

Other Threads