[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]


_ftype

To specify a Macintosh file type.

Compatibility:

This function is compatible with the following targets:

ANSI
BeOS
EMB/RTOS

Mac OS

Palm OS
Win32

Prototype:
#include <unix.h>
extern long _ftype;
Remarks:

Use the global _ftype to set the creator type for files created using the Standard C Libraries. "Using global variables to set file creator and type." is an example of the use of the global variable _ftype.


TIP

The value assigned to _fcreate and _ftype is a ResType (i.e. four character constant).
Using global variables to set file creator and type.:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unix.h>

#define oFile "test file"
const char *str = "Metrowerks Software at Work";


int main(void)
{
   FILE *fp;
   _fcreator = 'ttxt';
	_ftype = 'TEXT';
	
	// create a new file for output and input
	if (( fp = fopen(oFile, "w+")) == NULL) 
	{	
		printf("Can't create file.\n");
		exit(1);
	}

	fwrite(str, sizeof(char), strlen(str), fp);
	fclose(fp);

	return 0;
}

// output to the file using fwrite() Metrowerks Software at Work

[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]

Visit the Metrowerks website at: http://www.metrowerks.com
For assistance contact Metrowerks Technical Support at: cw_support@metrowerks.com
Copyright © 2000, Metrowerks Corp. All rights reserved.

Last updated: August 16, 2000