Undo() function... need advice
Hi. in couple of days I have to start writing program in which has to be Undo() function (and it's service functions), that function as my lecturer says, have to be able do all undo operations from the start of the program. One of suggestions was to save all data to files after any change. maybe it is a little more human way to do that?
Or it is the only way to save all informacion after any act in program and with undo() function only to load that data back?
# 1
Please explain what your program does and how many data is involved... If you operate on large files, you'll waste a lot of disk- or memory space. You could save only the parts that change.
You could also just push the sequence of your actions onto a stack and when you undo, just pop the topmost action. You should then define a separate undo for every operation...
# 2
in case of runing out of disc is necessary, really data will be up to 1Mb(but I don't think it would reach these 1Mb), and programn is only for showing to the lecturer what and how you done program.
main program purpose is to do it with variable socketed list, use it(write data in/out, from/to file and to show it in program window and else), do some operations with that list, make and use undo() function