KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Using Open resource file, The Mac File System, and forks
PRODUCT: 4D | VERSION: 11 | PLATFORM: Mac & Win
Published On: June 11, 2009

The Macintosh file system used to use two forks, data and resource, for storing files. Windows and UNIX operating systems only understand flat data files. This can cause problems with 4D's resource files and the Open resource file command. If you try to use Open resource file, on Windows, using one of these Mac style, forked resource files, you will get an error with Error Code -199.

Mac OS X, though a UNIX operating system, works around this problem transparently for the user. Windows does not. When these files are transferred to a Windows OS the resource fork shows up as a file prefixed with ".__".

Using 4D on a Mac, Create resource file will create the traditional Mac OS resource file. An example of that is shown here:

$vhResFile:=Create resource file("MyPrefs";"rsr")


The same call when using 4D on Windows will create a resource file in cross platform format. The resources are written into the data fork. To avoid the problem when on a Mac use the 4D cross platform compatible method of creating a resource file: the optional "*" parameter of Create resource file, as shown here:

$vhResFile:=Create resource file("MyPrefs";"rsr";*)


This will write the resources into the "data" fork and the file will be handled properly by 4D v11 SQL on both the Mac and Windows operating systems.