Connecting Tech Pros Worldwide Forums | Help | Site Map

File Copy Problem.

Newbie
 
Join Date: Nov 2006
Posts: 9
#1: Nov 15 '06
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?

Banfa's Avatar
AdministratorVoR
 
Join Date: Feb 2006
Location: South West UK
Posts: 6,185
#2: Nov 15 '06

re: File Copy Problem.


Quote:

Originally Posted by shadowsoulja

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.
Newbie
 
Join Date: Nov 2006
Posts: 9
#3: Nov 15 '06

re: File Copy Problem.


nothing is ever easy...

okay, i need to copy one file to another directory, what wud be the easiest way to do this?
Banfa's Avatar
AdministratorVoR
 
Join Date: Feb 2006
Location: South West UK
Posts: 6,185
#4: Nov 15 '06

re: File Copy Problem.


On what system, Windows?
Newbie
 
Join Date: Nov 2006
Posts: 9
#5: Nov 15 '06

re: File Copy Problem.


Quote:

Originally Posted by Banfa

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.
Banfa's Avatar
AdministratorVoR
 
Join Date: Feb 2006
Location: South West UK
Posts: 6,185
#6: Nov 15 '06

re: File Copy Problem.


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)
Reply