I didn't describe the problem I was experiencing becasue it seemed unlikely that anyone else would ever find themselves in this particular bind. That, and it didn't seem germane to the question I was asking -- namely, what to include in the project so as to access Carbon file routines from a command-line app (thanks for answering that one, Jonas!).
But Felipe asked, so here goes --
I am porting a program from CodeWarrior Pascal under Mac OS 9 to FPC/Xcode under Mac OSX 10.4, and I've encountered an anomaly that seems to bear on FPC's (Turbo-Pascal-based) file i/o, as follows:
The program I'm porting needs to intercommunicate with a large piece of legacy LISP code (running under Windows 98) via a primitive file-exchange protocol. The way it works is: my Pascal code writes a file containing a query to a shared folder, then waits in a tight loop for the LISP to read and delete it and write a response-file to the same folder, which my code then reads and deletes, and so on. Embarrassingly dumb, I know, but I'm not in a position to upgrade the LISP code to a more modern IPC protocol. :(
Be all that as it may, this whole Rube Goldberg runs great when compiled under CodeWarrior using MPW file i/o routines. With FPC's Turbo routines, I'm seeing some strange "race conditions" that lead me to believe the FPC version of the program perhaps is not completely relinquishing its hold on a file even after it's been flushed and closed. Whatever the cause, the end result is that the file persists in the shared folder after the LISP code thinks it's deleted it, confusing matters in a big way.
I've been thinking that I might evade the problem if I dropped back to native Mac file i/o (StandardFile or equivalent). I can't go Carbon whole hog, because my app is supposed to be faceless and, in fact, cross-platform.
Under the circumstances, I despaired of constructing a simple code snippet that would illustrate the problem, so I just asked the key question regarding how to give a command-line (Terminal) app access to the Mac FileManager routines. Sorry for any confusion.
Bill
PS: In this context, "flaky" = erratic and incomprehensible. :)
