亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費注冊 查看新帖 |

Chinaunix

  平臺 論壇 博客 文庫
12下一頁
最近訪問板塊 發(fā)新帖
查看: 7209 | 回復(fù): 12
打印 上一主題 下一主題

fopen("/dev/tty","r")失敗,errno=25 ,什 [復(fù)制鏈接]

論壇徽章:
0
跳轉(zhuǎn)到指定樓層
1 [收藏(0)] [報告]
發(fā)表于 2005-07-21 11:34 |只看該作者 |倒序瀏覽
如題,運行環(huán)境:VMware+debian3.1+X Window
誰能告訴我什么原因嗎?

論壇徽章:
1
榮譽版主
日期:2011-11-23 16:44:17
2 [報告]
發(fā)表于 2005-07-21 11:36 |只看該作者

fopen("/dev/tty","r")失敗,errno=25 ,什

perror("fopen";
printf("%s\n",strerror(errno));

論壇徽章:
0
3 [報告]
發(fā)表于 2005-07-21 11:46 |只看該作者

fopen("/dev/tty","r")失敗,errno=25 ,什

說是 Inappropriate ioctl for device 什么意思?

論壇徽章:
0
4 [報告]
發(fā)表于 2005-07-21 11:48 |只看該作者

fopen("/dev/tty","r")失敗,errno=25 ,什

我運行的是《linux程序設(shè)計》第5章里的例程啊,到底什么原因呢,俺是菜鳥

論壇徽章:
0
5 [報告]
發(fā)表于 2005-07-21 11:49 |只看該作者

fopen("/dev/tty","r")失敗,errno=25 ,什

試下這樣行不行
fopen("\\dev\\tty","r"

論壇徽章:
0
6 [報告]
發(fā)表于 2005-07-21 11:53 |只看該作者

fopen("/dev/tty","r")失敗,errno=25 ,什

樓上那樣就會產(chǎn)生段錯誤

論壇徽章:
0
7 [報告]
發(fā)表于 2005-07-21 11:55 |只看該作者

fopen("/dev/tty","r")失敗,errno=25 ,什

#include <errno.h>;

#include <stdio.h>;
#include <unistd.h>;
char *menu[]={
        "a - add new record",
        "d - delete record",
        "q - quit",
        NULL,
};
int getchoice(char *greet, char * choices[],FILE *in,FILE *out);
int main()
{
        int choice = 0;
        FILE *input;
        FILE *output;
        if(!isatty(fileno(stdout))){
                fprintf(stderr,"You are not a terminal! OK\n";
        }
        input = fopen("/dev/tty","r";/*---------------出錯的地方--------*/
        output = fopen("/dev/tty","w";
        if(input||!output){
                fprintf(stderr,"Unable to open /dev/tty,%d\n",errno);
                perror("fopen";
                fprintf(stderr,"%s\n",strerror(errno));
                exit(1);
        }
       
        do{
                choice = getchoice("lease select an  action ",menu,input,output);
                printf("You have chosen: %c\n",choice);
        }while(choice != 'q');
        exit(0);
}

int getchoice(char * greet, char * choices[],FILE *in,FILE *out)
{
        int chosen = 0;
        int selected;
        char ** option;
        do{
                fprintf(out,"Choice: %s\n",greet);
                option = choices;
                while( *option){
                        fprintf(out,"%s\n",*option);
                        option++;
                }
                do{
                selected = fgetc(in);
                }while(selected=='\n');
                option = choices;
                while(*option){
                        if(selected == *option[0]){
                                chosen = 1;
                                break;
                        }
                        option ++;
                }
                if(!chosen){
                        fprintf(out,"Incorrect choice,select again \n";
                }
        }while(!chosen);
        return selected;
}

論壇徽章:
0
8 [報告]
發(fā)表于 2005-07-21 11:56 |只看該作者

fopen("/dev/tty","r")失敗,errno=25 ,什

大家?guī)兔幾g一下,看看是否能行好嗎?

論壇徽章:
0
9 [報告]
發(fā)表于 2005-07-21 11:56 |只看該作者

fopen("/dev/tty","r")失敗,errno=25 ,什

tty 是文件還是目錄???

論壇徽章:
0
10 [報告]
發(fā)表于 2005-07-21 12:01 |只看該作者

fopen("/dev/tty","r")失敗,errno=25 ,什

/dev/tty是當前的終端或會話,書上這么說的,算是文件了
您需要登錄后才可以回帖 登錄 | 注冊

本版積分規(guī)則 發(fā)表回復(fù)

  

北京盛拓優(yōu)訊信息技術(shù)有限公司. 版權(quán)所有 京ICP備16024965號-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報專區(qū)
中國互聯(lián)網(wǎng)協(xié)會會員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關(guān)心和支持過ChinaUnix的朋友們 轉(zhuǎn)載本站內(nèi)容請注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP