0

I'd make a basic C rpg game and I want to save data such as Exp, name, gold, ect.

How can i do it in C?

I went to c++ forum and saw it but fstream doesn't work on C.

thank You

3
Contributors
3
Replies
4
Views
9 Years
Discussion Span
Last Post by jephthah
0

>How can i do it in C?
File handling examples for C are all over the place, but I'm guessing you didn't bother to search this forum. Here's yet another example:

#include <stdio.h>

int main ( void )
{
  FILE *out = fopen ( "filename", "w" );

  if ( out != NULL ) {
    fprintf ( out, "Gold: 123" );
    fclose ( out );
  }

  return 0;
}

>I went to c++ forum and saw it but fstream doesn't work on C.
Well, duh. C++ isn't C.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.