[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
 

Novise problem med C, if() og curses.h



Hi!

Jeg har fået den nedenstående kode til at blive til et program som rent
faktisk fungere på min maskine. Jeg mangler dog noget før det er helt
færdigt:


#include curses.h

int main()
{
	int venus;
	
	initscr();
	cbreak();
	printw("Tryk B for at afslutte programmet!!!\n\n");
	refresh();
		
	do   
	{      
		venus = getch();	  
			system("ls", venus);   
	}while( venus != 'B' );    
	
	printw("\nTak for denne gang\n");
	
	endwin();

	return 0;
}

Altså programmet udføre kommandoen "ls" hver gang jeg trukker på en
taste, men jeg ville gerne have nogle forskellige mulighedder ind.
Jeg forestille mig at det f. eks kunne se sådan ud:


if( venus == 'a' );
system("ls", venus);

if( venus == 'c' );
system("ps", venus);

if( venus == 'd' );
system("ls -l", venus);

Hver gang jeg forsøger at sætte det ind et eller andet sted hvor jeg synes det kunne
stå får jeg fejlmeldinger ved kompileringen. Er der nogle som kan hjælpe mig hvordan jeg skal gøre det?

Og så en lidet mindre betydningsfyld ting. Den sideste printw skulle
være sådan en afsluttende bemærkning som står når man afslutter
programmet, men den bliver slet ikke udskrevet på skræmen.

/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] *