Gamestudio Links
Zorro Links
Newest Posts
Executing Trades on Next Bar Open
by vicknick. 06/13/24 08:51
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
0 registered members (), 1,295 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19059 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
[SOLVED]Question about deleting files from inside the runtime.. #362487
03/08/11 15:02
03/08/11 15:02
Joined: Aug 2005
Posts: 238
Caermundh Offline OP
Member
Caermundh  Offline OP
Member

Joined: Aug 2005
Posts: 238
I know if i want to have my game delete a file, i can use exec("del", "<filename>"), but that pops up this ugly little DOS window if i do it that way.

Is there either a way to delete a file without using exec() or a way to use exec() and not have the DOS window pop-up?



Last edited by Caermundh; 03/13/11 17:10.
Re: Question about deleting files from inside the runtime.. [Re: Caermundh] #362496
03/08/11 15:20
03/08/11 15:20
Joined: Jul 2010
Posts: 974
United Arab Emirates, Dubai
TheShooter Offline
User
TheShooter  Offline
User

Joined: Jul 2010
Posts: 974
United Arab Emirates, Dubai
What kind of file do you want to delete? Every time, when you startup your Game? Or only one time?


Staub ist das neue Prime!!

Programming is like sex:
One mistake and you have to support it for the rest of your life.

Aktuelles Projekt: http://thisiswargame.bplaced.net/index.html

A8 Commercial *freu*
Re: Question about deleting files from inside the runtime.. [Re: TheShooter] #362497
03/08/11 15:25
03/08/11 15:25
Joined: Feb 2011
Posts: 135
Myrkling Offline
Member
Myrkling  Offline
Member

Joined: Feb 2011
Posts: 135

Re: Question about deleting files from inside the runtime.. [Re: Myrkling] #362512
03/08/11 16:42
03/08/11 16:42
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
You can also use the windows api for that purpose. This is however a more costly approach. The function you need to call is SHFileOperation. You can find the ms documenation about the function here:

http://msdn.microsoft.com/en-us/library/bb762164(v=vs.85).aspx

Be careful. file_delete is much safer than using the windows api. If you use SHFileOperation there are pretty good chances the file operation cannot be inverted.


Always learn from history, to be sure you make the same mistakes again...
Re: Question about deleting files from inside the runtime.. [Re: Uhrwerk] #363619
03/13/11 17:10
03/13/11 17:10
Joined: Aug 2005
Posts: 238
Caermundh Offline OP
Member
Caermundh  Offline OP
Member

Joined: Aug 2005
Posts: 238
@The Shooter:

I am making a game that has only so many save slots (10). So for example, when the player chooses slot 1 - if there is already a game saved there I want the game to prompt the player "Do you want to overwirte this file: <filename>?". So basically i need to delete the file *1.save.

@Myrkling;

File_delete did the trick beautifully! thank you. I need to maybe RTFM occasionally i guess ;D (I usually do read the manual - i guess i just missed that somehow)


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1