[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
 

Omstrukturering af c/lncurses prog.



Kære kodejunglører

Nederst på denne mail er kilde koden til et ganske lille c/ lncurses
program som jeg har lavet bla. med hjelp fra denne liste. Det fungere
fint; når det har modtage en indtastning som opfylder et af
kriterierne udfører det, det tilhørende systemkald og går dernæst til
toppen af loop'et og venter på en ny indtastning.
Nu vil jeg gerne lave det om så det i stedet. når det har modtaget en
indtastning som opfylder et af kriterierne udfører det tilhørende
systemkald og dernæst simpelthen afslutter programmet. Jeg har prøvet
at indsætte afslutningen af progammet under hvert "if udsagn" efter
system kaldet sådan:

if(venus == 'c')	
system("cp blaa.txt farve.sh");
endwin();
return 0;

Uden at foretage nogle andre endringer. Det giver følgende resulatat.
Programmet compilere uden fejlmeldinger. Programmet lukker når jeg
indtaster a, b eller c, men det er kun når jeg taster a, altså den
øverste af "if udsagnene" at det tilhørende systemkaldet bliver
udført. Er der nogen som har et forslag til en mere succesfuld måde at
lave den ønsked omstruktureing på?

Med venlig hilsen
Mikkel

#include curses.h

int main()
{
	int venus;
	
	initscr();
	cbreak();
	printw("Tryk D for at afslutte programmet!!!\n\n");
	
	
		
	do{
	refresh();
	venus=getch();	

		if(venus == 'a')	
			system("cp roed.txt farve.sh");
		
		if(venus == 'b')	
			system("cp groen.txt farve.sh");
		

	                if(venus == 'c')	
			system("cp blaa.txt farve.sh");
		

	}while( venus != 'D' );
	
	printf("\nTak for denne gang\n");
	
	endwin();

	return 0;
}


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2006-06-01, 02:01 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] *