Hi Again,
Well i'm bored and i've decided to do some coding just for practice and i've decided to work on a text based RPG, its only going to be basic due to my own knowledge but i think its doable. unfortunatly i've come accros a problem already and i've only writen a few lines of code.
The code deals with creating new character data, i plan to have all the character data stored in a text file, when the user starts a new game the program will ask for the character name then create a text file with this name write the players name and then close the text file.
heres the code that i have so far, this will eventualy be put into its own seperate function but for now its all in main().
#include <string.h>
#include <stdio.h>
#include "input.c"
FILE *playerdata;
int main(void)
{
int buffer = 11;
char name[buffer];
printf("Please Enter Your Name\n");
printf("Maximum Length 10 characters\n");
fgets(name,buffer,stdin);
playerdata = fopen(name, "W+"); /*create the new file*/
fgets(name,buffer,playerdata); /*write the players name to the file*/
fclose(playerdata); /*close the file*/
}
thanks in advance for any help,
-Matt