while (choice != QUIT)
{
choice = get_menu_choice();
if (choice == 1)
{
while(1)//while loop that i want to break out of
{
puts("please give your archive a name and a path:\n");
scanf("%s", &archive_name);
if( create_pointer = fopen(archive_name, "r") != NULL)
{
printf("file already exists\n");
continue;
}
else
{
create_pointer = fopen( archive_name, "ab");
puts("archive created\n");
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");
original_pointer = fopen(original_file,"a+b");
copy_pointer = fopen( archive_name,"a+b");
}
while (( n = fread(buffer,1,sizeof buffer, original_pointer)) > 0)
{
fwrite(buffer,1, n , copy_pointer);
}
if((original_pointer !=NULL) && (copy_pointer != NULL))
{
fclose(original_pointer);
fclose(copy_pointer);
fclose(open_pointer);
printf("done..... %s copied to %s.\n",original_file,archive_name);
get_menu_choice();
}
if (original_pointer == NULL)
{
puts("unable to open original file\n");
}
if (copy_pointer == NULL)
{
puts("unabe to open copiedied file");
get_menu_choice();
fclose(create_pointer);
}
//break goes hear but i get a segmentation fault error
}
moroccanplaya
0
Junior Poster
Recommended Answers
Jump to PostWould you care to explain a little more what the problem is? You posted several while loops -- which one(s) is giving you the problem?
All 4 Replies
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
moroccanplaya
0
Junior Poster
ravenous
266
Posting Pro in Training
sbesch
2
Newbie Poster
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.