コード例 #1
5
ファイル: libretron.c プロジェクト: Pyr0x1/Libretron
int main(void) {

	GuiStrings gStrings;
	GuiElems gElems;
	Settings settings;
	FileNames fNames;

	initGuiStrings(&gStrings);          // initializes strings to be displayed by gui
	initFileNames(&fNames);             // initializes data file and config file names
	initSettings(&settings, &fNames);   // initializes setting data structure
	initListStore(&gElems, &fNames);    // initializes data structures to display marks

    createGui(&gElems, &gStrings, &settings, &fNames);

    dumpSettings(&settings, &fNames);   // writes settings to file
    compactDataFile(&fNames);           // makes row numbers progressive eliminating "holes"

    freeGuiStrings(&gStrings);
    freeFileNames(&fNames);

	return EXIT_SUCCESS;
}
コード例 #2
0
ファイル: nclog.cpp プロジェクト: hjgode/c00p
static int writefile(TCHAR *filetext){
	/* File Write Function, written by professor chemicalX */
	FILE	*fp;						/* Declare FILE structure */
	TCHAR  szTemp[255];
	char  szTempA[255];

	wsprintf(szTemp, L"%s", filetext);
	wcstombs(szTempA, szTemp, sizeof(szTemp)/sizeof(TCHAR));

	if (bFirstFileCall){
		// Get name of executable
		initFileNames();
	}

	fp = fopen(logFileName, "a+");

	/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
	/* First of we open the file supplied by the filename paremeter */

	/*
	 * in the "a+" mode for appending, so if it doesnt exist its created. £
	 * fp = fopen(filename,"w"); // Open using the "w" mode for writing.
	 */
	long	fsize = strlen(szTempA);	/* Declare the long fsize with the length of the filetext */
	/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
	
	/* paremeter witch stores the text or data to right to the file. */
	fwrite(szTempA, 1, fsize, fp);		/* Write File */
	fclose(fp); /* Remember to close the file stream after calling file functions, */

	/* otherwise the file wont be created. */
	return 0;
}