Making a new file extension

I remember a game I played a while ago that stored all of it's character information inside of a .txt file. It really made it easy to open the right file and make a few tweaks that would make your character invincible, or make really good items especially cheap to buy.

I was wondering how hard it would be to make a new file extension that would only be readable by my game so I can safely store character and game info. Something that works basically like any .txt file but won't be recognized by anything except my programing.

Anyone know how to do this or have a good tutorial for it?
You would save the data as binary in stead of text.
ofstream f;
F.open("test.gom", ios::binary);
you can write functions and structs in C++ that are of all of your own definitions is the closest I can think of to something like that. Otherwise you seem to be suggesting to write an entirely new coding language. . .
I mean, its possible but it would still have to follow standards in order to integrate into anything useful.

I do know that there are many games like for the PC where you can alter the .dll files in order to attain an "upper-hand" over regular users...

mainly these games are for pc since they are the easiest to access for the source files.
Thanks pogrady, that was so much easier than I expected, but it works like a charm.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <iostream>
#include <fstream>
#include <string>

using namespace std;
int main()
{
	string input = "0", output = "0";
	
	ofstream fileout("file.tbg", ios::binary);
	if(fileout.is_open())
	{
		while(output != "stop")
		{
			getline(cin, output);
			fileout<<output<<" "<<endl;
		}
		fileout.close();
	}

	ifstream fileIn("file.tbg", ios::binary);
	if(fileIn.is_open())
	{
	while(fileIn.good())
	{
		getline(fileIn, input);
		cout << input<<endl;
	}
	fileIn.close();
	cin>>output;
	}
	else
	{
		cout<<"Didn't work";
	}
	return 0;
}
Last edited on
Topic archived. No new replies allowed.