can some one help me why its not copying the file ?

if(choice = 2)
		{
		puts("please open your archive\n");
		scanf("%s",&archive);
		archive_pointer = fopen( archive, "r+b");  //opens the archive
		
		puts("please select the file you want to be copied into your archive\n");
		scanf("%s",&original_file);
		open_pointer = fopen( original_file, "r+b");	//opens the file that needs to be copied							 
		
		original_pointer = fopen(original_file,"a+b");
									
		copy_pointer = fopen( archive,"w+b"); 

while (( n = fread(buffer,1,sizeof buffer, original_pointer)) > 0);
		{
		fwrite(buffer,1, n , copy_pointer)

deleted lines 5 and 9 because they serve no purpose and are probably screwing up the rest of your program.

Also, make sure you close both files before leaving that if clause.

The semicolon at line 15 means that the code actually is

while (( n = fread(buffer,1,sizeof buffer, original_pointer)) > 0)
    /* Do nothing */
    ; /* End of loop */
		{
		fwrite(buffer,1, n , copy_pointer)

and fwrite is called once, after the loop finished, with n equal to -1.

Also, line 1 doesn't do what you want to.

thanks guys for the help i have got it working, but i do still need line 5 and 9 or else i get a segmentation fault thanks again much appreciated

"archive" is a string, and so scanf("%s", archive); is correct. Remove the ampersand from in front of your "archive", in that line of code.

Same is true for "original file", in line #9. Remove the ampersand.

The address will be correct, but the pointer will be of the wrong type.

You need three pointers to work with three files simultaneously. You are using four now, which is prone to errors, and confusing. Get the logic straight in your mind.

In the while statement, "n = " is unnecessary.

The address will be correct, but the pointer will be of the wrong type.

how do i make the pointers right ?

This question has already been answered. Start a new discussion instead.