so far the user can select a file that he want to open to be copied, is there a way of letting the user selecting multiple files to be copied to one file? i was thinking of looping around asking the user to add another file if the user wanted to and that would take ages if the user had a lot of files

printf("please give your archive a name and a path:\n");
scanf("%s", &archive_name);
create_pointer = fopen( archive_name, "wb");	

printf("please type in the path for the file you want to archive\n");	




copy_pointer = fopen( archive_name,"wb");

is there way of letting the user selecting multiple files ?

If you're accepting file names from stdin, a loop is pretty much the only option. You can streamline the process a little by giving users the option of simply typing all of the files at once:

printf("Files to archive: ");

while (scanf("%s", filename) == 1)
    archive(archive_name, filename);

As long as there's no embedded whitespace in the path, you're solid. If embedded whitespace can be expected, scanf isn't suitable. You'd probably want to mimic the command shell's quoting rules, or possibly require the user to provide a manifest file which contains all of the paths to be archived (one on each line). Then fgets can be used instead of scanf.

Copying multiple files into one??

may be cat command you are saying abt?

yes copying multiple files into one im trying to make an archive

i looked at the code its not what i wanted really but thanks it will be usefull later on.

narue i tried putting the code to work, i just dont understand this part


i just get this error

(.text+0x6c): undefined reference to `archive'

>i just get this error
>(.text+0x6c): undefined reference to `archive'

Use your brain. The archive function in my example is a placeholder for the code you're using to copy files. I'm not going to write this all for you.

it just confused me with my code that's all

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.