void HumanoidDataLogger::saveData()
{
	const wxDateTime now = wxDateTime::UNow();
	
	wxString dataDirectory(dataSaveDirectory.c_str(),wxConvUTF8);
	wxString curFilePath = dataDirectory + wxT("/recentData.dat");
	
	dataDirectory += now.FormatISODate();
	wxString dataFile =  now.FormatISODate() + wxT("_") + now.FormatISOTime() + wxT(".dat");
	dataFile.Replace(wxT(":"), wxT("-"));
	
	wxString dataPath = dataDirectory + wxT("/") + dataFile;
	
	if(! wxDirExists(dataDirectory))
	{
		wxMkdir(dataDirectory);	
	}
	
	stringstream ss;
	ss << dataPath.mb_str();
	setFile(ss.str());
	writeRecords();
	
	FILE * curFile = fopen(curFilePath.mb_str(),"w");
	fprintf(curFile, "%s",ss.str().c_str());
	fclose(curFile);
}
int main() {

	writeRecords();


	return 0;
}
Example #3
0
int main (int argc, char **argv)
{
	srand(time(0));

	MAP map;
	setDefaults(&map);

	PLAYER hero;
	startPlayer(&hero);

	getargs(&map, &hero, argc, argv);

	startMap(&map);
	hero.face = map.elements.hero.face;
	hero.pos = putElement(&map, hero.face);

	GHOSTS ghosts;
	ghosts.face = GHOST;
	ghosts.count = 0;

	startGhosts(&map, &ghosts);

	fflush(stdout);
	initscr();
	nodelay(stdscr, TRUE);
	noecho();
	keypad(stdscr, TRUE);

	if (map.props.hascolor)
		startColors();

	struct timespec tim, tim2;
	tim.tv_sec = 0;
	tim.tv_nsec = map.props.speed;

	do {
		nanosleep(&tim, &tim2);
		getCommand(&hero);
		walk(&map, &hero, &ghosts);
		showMap(&map, &hero, &ghosts);
		repopMap(&map);
		upGhosts(&map, &ghosts);
		walkGhosts(&map, &ghosts);

	} while (!isDead(&hero));

	if (!noRecords)
		writeRecords(&hero, &ghosts);
	finalize(&map, &ghosts);
	finalText(&map, &hero, &ghosts);

	exit(0);

}
void RegionBuilder::write(const Streamline& streamline)
{
    writeRecords(streamline);
    writeTimelines();
    writeValues();
}