Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error Using fpurge(stdin);

Here is the Part of the program that i am trying to compile using gcc compiler on ubuntu 14.04.

#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);
}

this is the Error:

 /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
like image 779
user3111 Avatar asked May 10 '26 13:05

user3111


1 Answers

fpurge is not in the standard C library. It is nonstandard and not portable. It is a BSD function.

http://bytes.com/topic/c/answers/845246-fpurge

like image 194
John Avatar answered May 12 '26 07:05

John



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!