⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ofile.c

📁 这是一个MINITGUI2。0的应用程序
💻 C
字号:
#include <ctype.h>#include <errno.h>#include <fcntl.h>#include <signal.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <sys/ioctl.h>#include <sys/wait.h>#include <sys/stat.h>#include <unistd.h>char * file="/usr/local/etc/ipconfig";int getipport(char *relip,char *relport){	int fd;	int num;	int i = 1, j = 0;	char buf[26];	char ipbuf[20];	char portbuf[5];	char *ip;	char *port;	if((fd = open(file, O_RDONLY, 0)) < 0){		printf("can't open file\n");			//perror("open");			return 1;	}	else{		printf("\n\nopen the %s successful\n");	}		num = read(fd,buf,26);	if(num < 0){		printf("read err\n");		return 2;	}	printf("read ok the data is %s",buf);	while(buf[i]!='"'){				ipbuf[i-1] = buf[i];		i++;			}	ipbuf[i-1] = '\0';	printf("\nlbub = %s",ipbuf);	ip = ipbuf;	printf ("\nthe ip is %s\n",ip);	i = 0;	while(buf[i++] != '*') ;	for(j = 0;j<4;j++){		portbuf[j] = buf[i++];	}	portbuf[j] = '\0';	printf("\nportbuf = %s",portbuf);	port = portbuf;	printf("\nthe relport is %s\n",port);	relip = ip;	relport = port;	close(fd);	return 0;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -