int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpArgv, int nShowCmd) { printHeader(); startupProgram(hInstance); printf("\n"); printf("We recommend setting your game to %s resolution in windowed mode.\n", gameState.gamedef.recommendResolution); if (gameState.gamedef.extraRecommendations != (char*)NULL) { printf("%s\n", gameState.gamedef.extraRecommendations); } printHotkeys(); mainLoop(); cleanupProgram(); return 0; }
/** * Main function of this program. Opens the output file, and shows the main * menu to the user * @return 0 or OK for success, any other number for failure */ int main(void) { system("clear"); // open the output file outputFile = fopen("a4output.txt", "w"); // set the library's file output buffer to zero. Writes straight to file setbuf(outputFile, NULL); if (!outputFile) { printf("Error opening file\n"); exit(ERR_OPENING_FILE); } int menuChoice = -1; MovieNodeType *list = NULL; while (1) { mainMenu(&menuChoice); if (menuChoice == 0) { cleanupProgram(list); return OK; } else if (menuChoice == 1) { getMovieData(&list); } else if (menuChoice == 2) { menuDeleteMovie(&list); } else if (menuChoice == 3) { printMovieData(list); } else if (menuChoice == 4) { menuPrintMoviesByGenre(list); } else { continue; } } }