Archived

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

Agrelahar

File Editing

Recommended Posts

*gets on his knees to beg and makes a puddle of tears* :''(

Will anyone tell me how to copy files to another location in c++? Even pointing me to a tutorial/website would be acceptable.

I wouldn''t keep bugging, but I looked on google for about 15 minutes and then looked on the forum without finding what I wanted.

*promises to never bump again*

Share this post


Link to post
Share on other sites
Here it goes, but it isn't for free. You owe me a dozen cookies now.

Reading from file
Reading from file, part 2
Writing files

That should do the trick. If not, buy a good book on C++, it might help you. btw, for making an installer, you only need to know how to insert files as a resource into an installer and how to retrieve them as resource handle. Then you can write the files using file i/o. And for copying, check out the win32 platform SDK.

Toolmaker



-Earth is 98% full. Please delete anybody you can.

[edited by - toolmaker on October 22, 2003 6:50:10 PM]

Share this post


Link to post
Share on other sites
quote:
Original post by Toolmaker btw, for making an installer, you only need to know how to insert files as a resource into an installer and how to retrieve them as resource handle. Then you can write the files using file i/o.

I don''t believe I''m allowed to use ready-to-use installers for what I''m doing if that''s what you mean, but I''ll check out the win32 sdk thing tomorrow morning (my 56k conn. gets slower than s-mail at night).

Thanks.

Share this post


Link to post
Share on other sites
I need to use an installer though. :/

__________________________________________
So all of you talent-seekers from EA can find me more easily, here is my resume:
I have made nothing in C++. No, really, I have made a program that says "Hello world!". No, really, I have made a number guessing game. No, really, I have made a simple battelship game using only arrays. No, really, I actually tried to learn something from GPaiO. Now that''s difficult!

Share this post


Link to post
Share on other sites
Simple way to copy: open source file for reading, destination file for writing, then read a block from src and write it to dest. Should work with fopen and co. as well as with the C++ fstreams.

[edited by - VolkerG on October 23, 2003 5:37:14 AM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I know it seems archaic, but sometimes I use dos commands in my programs. All you have to do is use

system("copy file1.??? file2.???";

and it should work on all windows OS''s. It may be poor style, I know nothing about style because I learned programming from a C book from the 80''s, but it works. It may not be ''allowed'' (Homework, anyone?), but it is one easy way to do it.

Share this post


Link to post
Share on other sites
What''s the exact syntax for using that method, AP?

I can open up source files on a computer without a compiler, VG?

__________________________________________
So all of you talent-seekers from EA can find me more easily, here is my resume:
I have made nothing in C++. No, really, I have made a program that says "Hello world!". No, really, I have made a number guessing game. No, really, I have made a simple battelship game using only arrays. No, really, I actually tried to learn something from GPaiO. Now that''s difficult!

Share this post


Link to post
Share on other sites