| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 
 | void Load_Game(int sudoku_board[][9], int start_board[][9])
{
	int i, j, sud_games, len, ch;
	string sud_file, File_Location = "";
	string rub(24,' '), border(78,'\xCD');
	string File_Name,Sudoku_Name;
	GetCurrentPath(CurrentPath);  // Gets path to executable
	i=0;
	while(CurrentPath[i] !=NULL)
	{
		File_Location = File_Location + CurrentPath[i];
		i++;
	};
	
	File_Location = File_Location + "\\Saves\\"; // Adds 'Saves' directory for search
			
	Box( 2,23,8,34,12,light_green,black,2,light_gray,dark_gray);
	BoxLineAcross(4,23,11,34);
	BoxLineAcross(4,23,15,34);
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 48);
	gotoXY(28,20);
	cout << "\xB3 \xBA \xB3 \xB3 \xBA \xB3 \xB3 \xBA \xB3 \xB3 \xBA \xB3";
	for ( i=0;i<9;i++ )
	{
		gotoXY(31+(i*2),20);
		if ( sudoku_board[i][6] > 0)
			cout << sudoku_board[i][8];
		else
			cout << " ";
	}
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 160);
	 string dir = string(".");
    vector<string> files = vector<string>();
	getdir(File_Location,files);
    sud_games = 0;
    for (unsigned int i = 1;i < files.size();i++)
	{
        	len = files[i].length();
			sud_file = "";
			for ( j=0;j < len;j++)
			{
				if (files[i][j]!= '.')
					sud_file = sud_file+files[i][j];
				else
					break;
			}
			files[i-1] = sud_file;
			sud_games++;
	}
	sud_games--;
	gotoXY(30,9, "Load which file name");
	gotoXY(33,10, "into the grid?");
	gotoXY(28,16, "Use the Up and Down keys");
	gotoXY(27,17, "to select the desired file,");
	gotoXY(31,18, "then press 'Enter'.");
	i=1;
	
	gotoXY(32,13, files[i]);
	gotoXY(27,14,"\x1F");
	do
	{
		ch = _getch();
		switch(ch)
		{
		case ENTER:
			SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 112);
			Sudoku_Name = files[i];
			gotoXY(1,0,border);
			len = (80-Sudoku_Name.length())/2;
			gotoXY(len-2,0,"\xB5 "+Sudoku_Name+" \xC6");
			break;
		case UP:  // Scrolls file names upward
			if(i-1 > 0)
			{
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 160);
				i--;
				if (i > 1)
					gotoXY(27,12,"\x1E");
				else
					gotoXY(27,12," ");
				gotoXY(27,14,"\x1F");
				gotoXY(32,13, rub);
				gotoXY(32,13, files[i]);
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 176);
				gotoXY(29,28,"Load an Existing Game");
			}
			else
			{
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 176);
				gotoXY(29,28,"   Top of file list  ");
			}
			break; 
		
		case DOWN: // Scrolls file names down
			if(i+1 <= sud_games)
			{
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 160);
				i++;
				gotoXY(27,12,"\x1E");
				gotoXY(27,14," ");
				
				if (i < sud_games)
					gotoXY(27,14,"\x1F");
				
				gotoXY(32,13, rub);
				gotoXY(32,13, files[i]);
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 176);
				gotoXY(29,28,"Load an Existing Game");
			}
			else
			{
				SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 176);
				gotoXY(29,28," Bottom of file list ");
			}
		}
		
	} while ( ch != ENTER);
	
	File_Name = File_Location + Sudoku_Name + ".sud";
	
	ifstream infile(File_Name.c_str());
		SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 176);
		for (i=0;i<9;i++)
		{
			for ( j=0;j<9;j++)
			{
				infile >> sudoku_board[j][i];
				gotoXY((j*2)+31,(i*2)+6);
				if ( sudoku_board[j][i] > 0 )
					cout << sudoku_board[j][i];
			}
		}
		for (i=0;i<9;i++)
		{
			for ( j=0;j<9;j++)
			{
				infile >> start_board[j][i];
			}
		}
		infile.close();
	ReNew( sudoku_board ); // Clears the request, leaving the board
	Get_Numbers(sudoku_board, 0, 0 );
}
 |