?? menu.c
字號:
/**************************************************************
程序說明 :FreeDev輸入輸出和菜單模塊
類 型 :Nios II
說 明 :
測試系統(tǒng)菜單相關(guān)函數(shù)
**************************************************************/
#include <stdio.h>
#include <alt_types.h>
#include <io.h>
#include <system.h>
#include <string.h>
/*********************************************
函數(shù)名:MenuHeader(void)
功 能:菜單頭顯示函數(shù)
輸 入:
返 回:
備 注:
**********************************************/
void MenuHeader(void)
{
printf("\n\n");
printf("數(shù)字音頻處理控制系統(tǒng)實驗. <---->\n");
printf("Audio音頻開發(fā)系統(tǒng)\n");
}
/*********************************************
函數(shù)名:MenuBegin(char *title)
功 能:顯示菜單開始
輸 入:
返 回:
備 注:
**********************************************/
void MenuBegin( char *title )
{
printf("\n\n");
printf("----------------------------------\n");
printf("%s\n",title);
printf("----------------------------------\n");
}
/*********************************************
函數(shù)名:MenuItem(char letter, char *name )
功 能:顯示菜單項
輸 入:
返 回:
備 注:
**********************************************/
void MenuItem( char letter, char *name )
{
printf(" %c: %s\n" ,letter, name);
}
/*********************************************
函數(shù)名:MenuEnd( char lowLetter, char highLetter )
功 能:顯示菜單結(jié)束并接收用戶輸入
輸 入:
返 回:
備 注:
**********************************************/
int MenuEnd( char lowLetter, char highLetter )
{
static char entry[3];
static char ch = 23;
printf(" q: Exit\n");
printf("----------------------------------\n");
printf("\nSelect Choice (%c-%c): [Followed by <enter>]",lowLetter,highLetter);
fgets(entry, sizeof(entry), stdin);
if(sscanf(entry, "%c\n", &ch))
{
if( ch >= 'A' && ch <= 'Z' )
ch += 'a' - 'A';
if( ch == 27 )
ch = 'q';
if(ch != 'q' && ( ch < lowLetter && ch > highLetter ))
{
printf("\n -ERROR: %c is an invalid entry. Please try again\n", ch);
}
}
return ch;
}
/*********************************************
函數(shù)名:ShowSelect( char lowLetter, char highLetter )
功 能:顯示菜單結(jié)束并接收用戶輸入
輸 入:
返 回:
備 注:
**********************************************/
int ShowSelect(char *prompt,char sel1, char sel2 )
{
static char entry[3];
static char ch = 23;
while(1){
printf("----------------------------------\n");
printf("%s",prompt);
printf("\n請選擇(%c-%c): [回車確認]",sel1,sel2);
fgets(entry, sizeof(entry), stdin); //獲取屏幕字符
if(sscanf(entry, "%c\n", &ch))
{
if( ch == sel1 || ch == sel2)
break;
}
}
return ch;
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -