L D Blake
ldblake at sympatico.ca
Wed Sep 3 19:06:42 CEST 2003
This is in reply to your letter of September 3, 2003
> Hi all,
> I wrote 2 programs which are using the IPC queue. Now I have a
> problem, that often the the queue cannot be opened.
> I did some tests and cannot find out where the problem is.
> The relevant code is here:
> IPC_Key:=ftok(ipcqueue,'M'); // Eindeutigen Schlüsssel generieren
> IPC_ID:=msgget(IPC_Key,IPC_CREAT or 438); // Schnittstelle erstellen
> No matter what I do with /var/ipc the IPC-Queue doesn't get created.
> I tried /var/ipc as file, directory and not existent, but nothing helps.
> Does anybody here know the right procedure to open an ipc-queue. Thanks
> in advance for your help.
When I first started with FP I ran into a bunch of really strange behaviour.
Files that wouldn't open, garbage printed in edit boxes, things being saved
under garbled filenames etc.
In my case, which may or may not apply to what you are doing here, the problem
was the difference between the way Pascal and Windows handle strings. In
pascal a string is like this:
<Length Byte><string data....>
In windows (and I think Linux) it's like this:
If 'ipcqueue' is declared as type "string" could it be that your OS is seeing
the length byte as an error and failing to open the queue? (At least that's
what happened to me in win32).
The fix, for me, was to write a small unit to translate back and forth between
Pascal and Null Terminated strings.
L D Blake
More information about the fpc-pascal