这是我尝试在 ubuntu 14.04 上使用 gcc 编译器编译的程序的一部分。
#include<stdio.h>
#include<string.h>
main() {
int i;
char str[50], pat[3];
char sep;
printf("Enter the sting to seperate\n ");
scanf("%s", str);
fpurge(stdin);
printf("Enter the patern in Numbers to seperate Example : 1 2 3\n");
//__fpurge(stdin);
scanf("%s", pat);
fpurge(stdin);
printf("Enter the seperator Example: ; or enter ,space");
scanf("%c", &sep);
}
这是错误:
/tmp/cc0bHLkO.o: In function `main':
str_sepert.c:(.text+0x4d): undefined reference to `fpurge'
str_sepert.c:(.text+0x95): undefined reference to `fpurge'
collect2: error: ld returned 1 exit status
最佳答案
fpurge
不在标准 C 库中。它是非标准的,不
便携的。这是一个 BSD 函数。
关于c - 使用 fpurge(stdin) 时出错;,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33066454/