// Basic writing to a file
#include
<openxdk.h>
// Interesting thing, depending which directories and libs you've got added
// in Tools->Options in the VC++ Directories - I've only got:
//
// "Include files" -> C:\OpenXDK\include\
// "Library files" -> C:\OpenXDK\lib\
// "Executable files" -> C:\OpenXDK\bin\
// as I was following the doc setup, which means I have to specify the
// full path of the stdio.h file if I want to use i/o functions.
Alternatively
// just add the extra path to your include above, so you get away with <stdio.h>
#include
"OpenXDK\include\xlibc\stdio.h" // _open, _close
etc...
#include
<string.h> // strlen(..)
VOID
XBoxStartup()
{
char Buffer[] = "Test text - simple but
sweet";
// These file functions are defined in stdio.h
// e.g. int _open( char *filename, int oflag, int
permission );
int handle = _open( "D:\\test.txt", _O_RDWR|_O_BINARY|_O_CREAT|_O_TRUNC,
0 );
int AmountRead = _write( handle, &Buffer[0],
strlen(&Buffer[0]) );
_close( handle );
HalReturnToFirmware(ReturnFirmwareFatal);
}//
End
|