Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

MattMcC

C++ Copy files

This topic is 5826 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey, i want to make a program to copy save game files to a floppy. Though the name of the save files are different on very comp, each save file has a letter at the start of the file name hich is always te same but has 5 different numbers after. Also what is the a function in C++ to copy files? Thanks.

Share this post


Link to post
Share on other sites
Advertisement
okay... try this funcs

FileFindFirst
FileFindNext (maybe it''s FindFileNext)

to cpoy a file there is a shell function SHFileOperation I guess... if you don''t want to use windows, you have to load it and the save it somewhere else manually I guess...

If you have problems constructing the filename, try something like

char buffer[1000];

sprintf(buffer,"x%05d.ext", number);

this could give you x00004.ext for number = 4

good luck

Share this post


Link to post
Share on other sites
Luckily the to files i need 2 copy are the only ons in th folder with .erc extensions . Although i don't really want to se Win32 just plain C++ .

[edited by - MattMcC on August 30, 2002 8:41:30 AM]

Share this post


Link to post
Share on other sites
You could always use

system("copy file1 a:");

or something like that... build up the command string using sprintf as Caesar said.

"Most people think, great God will come from the sky, take away everything, and make everybody feel high" - Bob Marley

Share this post


Link to post
Share on other sites
Is there any articles etc i could read, can''t fnd much on google and im only a begginer o it''s quite confusing.

Share this post


Link to post
Share on other sites
If this is for a game you''ve bought, just write a batch (.bat) file and put it in the game''s directory.

something like this

copy a*.erc a:\

where ''a'' is the prefix letter

____________________________________________________________
www.elf-stone.com

Share this post


Link to post
Share on other sites
yea it is a game i have bought an it''s installed in it''s own directory.

Thanks but now im completely lost \>

Share this post


Link to post
Share on other sites
Is there any articles anyhere that would help, or could someone right a little more code plz, sorry for all the hasle.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
fread() and fwrite().

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!