I'm trying to write strings in files both in agk classic tier2 and in agk studio tier2 none of the writing functions work... what am I doing wrong?
mycode >
// Includes
#include "template.h"
// Namespace
using namespace AGK;
app App;
void SaveToFile(const char* file, const char* myString) {
int fileID = agk::OpenToWrite(file, 0);
if (agk::FileIsOpen(fileID) == 1) {
agk::WriteString(fileID, myString);
agk::CloseFile(fileID);
}
}
void app::Begin(void)
{
if ( agk::GetRenderer() )
{
agk::SetErrorMode(2);
agk::SetVirtualResolution (1024, 768);
agk::SetClearColor( 151,170,204 ); // light blue
agk::SetSyncRate(60,0);
agk::SetScissor(0,0,0,0);
const char* filePath = "C:\Games\myfile.txt";
const char* myString = "Olá, mundo!";
SaveToFile(filePath, myString);
}
}
int app::Loop (void)
{
agk::Print( agk::ScreenFPS() );
agk::Sync();
return 0; // return 1 to close app
}
void app::End (void)
{
}