ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Other Software > Developer's Corner

C++ - Saving / Loading data

(1/2) > >>

RedPillow:
Hi, first of all - I want someone to do exactly as I want and not to make any external ideas up or ask why i want it like so etc...

So, sorry bout that - to the topic:

I want a simple C++ example (with includings and stuff - a fully working program) which asks user a number and saves it TO THE EXE, TO A INI-FILE or TO A TXT FILE - or all 3.
But inorder to test this data-reading, I want it so - that when the program starts, it prints a list where user can read the saved numbers and after press of an enter, it will ask new number, saves that and again on startup it creates the list an so on...

I don`t need encryption, or security - I`ll do it later if I want, just give me example of that.

I would mostly want example of saving to exe and txt-file, ini is not so important.
Remember to test it, lol - so i dont have to reply with bugreport.


Thanks!

f0dder:
Demand demand demand! :)

What kind of "ask user number" functionality do you want? Since you only say "C++" I'd guess a console mode app, but it doesn't hurt specifying more explicitly.

A little note: saving to .exe won't work - there's been various tricks proposed during the years, but most of them have relied on undocumented stuff and don't work today. If you really want to save to exe, you have to take the route I've done with fSekrit: basically, copy current .exe to a temporary location, append data there, launch temporary .exe with special flag to make it overwrite original exe, launch now-overwritten-with-new-data original exe with flag to make it delete the temporary copy.

RedPillow:
I think just a simple "cin>>" for number-input is fine - as Im using that "Command-Propt-Like-Thingy".  :-[
Btw, I tried to create that "Virtual-Screen" (where you can create ie. pictures by adding colored pixels in it) by using some tutorial but it had something to do with Pascal and It doesn`T workd on Win7, 64bit - So is there any other way, pascal-tut was all about some weird assemblycode :|?

And let`s change the exe to the .dll then, that would be nice - no matter how sucky it is.  :tellme:

Crush:
The code isn´t a big thing to do, but I don´t understand how to save it to an .exe or .dll file? I see no sense in doing this or at least a way to do this without destroying the exe-file. Is this prog for educational use?

RedPillow:
It`s just because I presonally think it`s the most easiest thing to do o_O.

Let`s say that I wan`t to make a standalone prog with the ask number and list em on startup -functions, and I cannot use registry
(blocked from the prog).
And I want this program so standalone, that it is only the .exe - nothing else.

But like I said, I would even respect the example of doing it with .txt but dll and exe would be nice too!


P.S Speaking of is it for educational use... It is, but how do I make a program which uses different processes without any reason except that it won`t let user to close it cause of that?

Navigation

[0] Message Index

[#] Next page

Go to full version