Important: The information in this document is obsolete and should not be used for new development.
FSpCreate
You can use theFSpCreate
function to create a new file.
FUNCTION FSpCreate (spec: FSSpec; creator: OSType; fileType: OSType; scriptTag: ScriptCode): OSErr;
spec
- An
FSSpec
record specifying the file to be created.creator
- The creator of the new file.
fileType
- The file type of the new file.
scriptTag
- The code of the script system in which the filename is to be displayed. If you have established the name and location of the new file using either the
StandardPutFile
orCustomPutFile
procedure, specify the script code returned in the reply record. (See the chapter "Standard File Package" in this book for a description ofStandardPutFile
andCustomPutFile
.) Otherwise, specify the system script by setting thescriptTag
parameter to the valuesmSystemScript
.DESCRIPTION
TheFSpCreate
function creates a new file (both forks) with the specified type, creator, and script code. The new file is unlocked and empty. The date and time of creation and last modification are set to the current date and time.See the chapter "Finder Interface" in Inside Macintosh: Macintosh Toolbox Essentials for information on file types and creators.
Files created using
FSpCreate
are not automatically opened. If you want to write
data to the new file, you must first open the file using a file access routine (such
as FSpOpenDF).
- Note
- The resource fork of the new file exists but is empty. You'll need to call one of the Resource Manager procedures
CreateResFile
,HCreateResFile
, orFSpCreateResFile
to create a resource map in the file before you can open it (by calling one of the Resource Manager functionsOpenResFile
,HOpenResFile
, orFSpOpenResFile
).RESULT CODES