Yes, you could write a C program to generate all possible moves and write them to a text file.
The question you have to ask yourself, though ... is it worth it?
For instance, how would you go about determining which arrangement should follow the current one? If you implement this with AI, then you're doing the AI anyway, so you might as well go for the more traditional approach of just working with the board as is.
Or you could make a list ("if player moves and the board looks like this, then pull up that move from the list"). But it seems an awfully large undertaking, and certainly a lot more work than the traditional "analyze current positions and determine move based on a list of rules" approach.
Also note, both for the text file and the actual TTT program, the internal representation of the board does not have to match the visual representation.
For instance, you don't need this in your code:
Code:
char gameboard[5][5] = {
"X| | ",
"-+-+-",
"X|O|X",
"-+-+-",
" |O| "
};
Instead, you could have a simpler representation of the positions in your code (and text file); e.g.
Code:
char gameboard[9] = {'X',' ',' ','X','O','X',' ','O',' '};
And have a function just for printing that will print the game board to the screen in its visually recognizable form.