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

Recommended Answers

All 3 Replies

>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.

lol

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.