[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

RE: [PROGRAMMERING] C selvsving



Flyt din "do" op over getch().

>-----Original Message-----
>From: Mikkel Meinike Nielsen [mailto:sslug@sslug
>Sent: Thursday, March 18, 2004 1:10 PM
>To: sslug@sslug
>Subject: [PROGRAMMERING] C selvsving
>
>
>Hi!
>
>Denne kode kan kompileres uden fejlmeldinger og programmet 
>kan også udføres, men det fungere ikke halt efter hensigten. 
>Hvis jeg trykker 'a' bliver programmet ved med at udføre 
>komandoen "ls" igen og igen uden ophør. Meningen var at den 
>skulle udføre komandoen "ls" en gang og så vende tilbage til 
>ventepositioin (getch()).
>Kan nogen hjelpe mig?
>
>#include curses.h
>
>int main()
>{
>	int venus;
>	
>	initscr();
>	cbreak();
>	printw("Tryk B for at afslutte programmet!!!\n\n");
>	venus=getch();
>	refresh();
>		
>	do   
>	{      
>		if(venus == 'a')	  
>			system("ls");   
>		
>		if(venus == 'c')	  
>			system("ps");   
>		
>
>	
>
>	}while( venus != 'B' );    
>	
>	printw("\nTak for denne gang\n");
>	
>	endwin();
>
>	return 0;
>}
>
>
>Den version af programmet uden "if" som jeg sendte i gård
>havde ikke dette problem med at gentage komandoen.
>
>/Mikkel
>
>_____________________________________________________________
>Get your FREE, LinuxWaves.com Email Now! --> http://www.LinuxWaves.com
>Join Linux Discussions! --> http://Community.LinuxWaves.com
>


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 22:43 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *