By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,601 Members | 1,543 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,601 IT Pros & Developers. It's quick & easy.

File Copy Problem.

P: 9
public: static void
Copy
(
String* snap3.txt,
String* usercopy.txt
);

I am using the above code to copy a file to a new file and all i keep getting is:

E:\COLLEGE\Text1.cpp(19) : error C2143: syntax error : missing ';' before 'public'

This is probably really simple to solve, but i really cant figure it out.
The code before this line has a semicolon at the end... so this is really confusing me.

Can someone tell me what im doing wrong?
Nov 15 '06 #1
Share this Question
Share on Google+
5 Replies


Banfa
Expert Mod 5K+
P: 8,916
public: static void
Copy
(
String* snap3.txt,
String* usercopy.txt
);
This looks like the declaration of a member file, as such it should probable be something line

Expand|Select|Wrap|Line Numbers
  1. public: static void
  2. Copy
  3. (
  4.     String &file1,
  5.     String &file2
  6. );
This is a declaration of the function, it does nothing you will have to have a function definition at another place in you code.
Nov 15 '06 #2

P: 9
nothing is ever easy...

okay, i need to copy one file to another directory, what wud be the easiest way to do this?
Nov 15 '06 #3

Banfa
Expert Mod 5K+
P: 8,916
On what system, Windows?
Nov 15 '06 #4

P: 9
On what system, Windows?
visual cpp on windows....

its part of an assignment, and i need to copy a file from one directory to another.
Nov 15 '06 #5

Banfa
Expert Mod 5K+
P: 8,916
In that case I would suggest one of the functions

CopyFile or CopyFileEx

Although thatwill result in non-portable code (i.e. it will only compile on Windows)
Nov 15 '06 #6

Post your reply

Sign in to post your reply or Sign up for a free account.