i cant break out of this loop its driving me crazzy!!

while (1)
	{	
	
	printf("please type in the path for the file you want to archive\n");
	scanf("%s",&original_file);
	open_pointer = fopen( original_file, "rb");								 
	original_pointer = fopen(original_file,"rb");							
	copy_pointer = fopen( archive_name,"ab");
	
	if (copy_pointer  NULL)
	{
		printf("\n copied successfull");
		puts("\nenter  x to coninue");
   
	if   ((answer = getc(stdin)) == 'x')
		
		break;
		else
		continue;
			}

May be getc() wont return unless enter hit so use getch() which returns key pressed and neither echo it to the screen..

if   ((answer = getch()) == 'x')

Edited 5 Years Ago by Shankye: n/a

getch() completely worked fine for me ..

Here is code which compiled and worked for me ..

#include <stdio.h>

int main (void)
{

  char temp;
  while(1)
  {
     if( (temp=getch()) == 'x')
     {
        printf("Bye");
        exit(0);
     }
     printf("Looping");
   }
 return(0);
}

Write to fflush all the buffers and make stdin and stdout clean..

IF possible post full code, will try to compile and check whether it works here

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