To specify a Macintosh file type.
Compatibility:This function is compatible with the following targets:
|
ANSI
|
BeOS
|
EMB/RTOS
|
Palm OS
|
Win32
|
|
#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
#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;
}