void
varLoad (void)
{
int actorNum;
FILE * VARS = fopen("gameVars", "r");
fscanf(VARS, "%d,/n", &actorNum);
for(i=0; i<actorNum, i++)
{
fscanf(VARS, %d, %d,/n", &actorX[i], &actorY[i]); // actorX/actorY would be int arrays in global code
}
fscanf(VARS, "%s,/n", &TEXT); // TEXT is a char*, you could also just use the text actor's text variable
// you would repeat the above for any strings you want
// if any of the ones I did not explain you don't know how to do, just ask
fclose(VARS);
}
void
varSave(void)
{
int actorNum = sizeof(actorNum)/sizeof(int);
FILE *map = fopen("gameVars", "w");
fprintf(VARS, %d,/n", actorNum);
for (i=0; i<actorNum; i++)
{
fprintf(VARS, %d, %d,/n", actorX[i], actorY[i]);
}
fprintf(VARS, "%s,/n", TEXT);
fclose(VARS);
}
DST wrote:http://game-editor.com/forum/viewtopic.php?f=5&t=5703&hilit=+save+user+clones
int VAR[13];
char *TEXT;
void varSave(void){
int i = 0;
FILE *VARS = fopen("gameVars", "w");
for (i=0; i < 13; i++)
{
fprintf(VARS, "%d", VAR[i]);
}
// fprintf(VARS, "%s", TEXT);
fclose(VARS);
}
void varLoad (void){
int i = 0;
FILE * VARS = fopen("gameVars", "r");
for(i=0; i < 13; i++){
fscanf(VARS, "%d", &VAR[i]);
}
// fscanf(VARS, "%s", &TEXT);
fclose(VARS);
}
DST wrote:http://game-editor.com/forum/viewtopic.php?f=5&t=5703&hilit=+save+user+clones
Users browsing this forum: No registered users and 1 guest