কম্পিউটার টিউটোরিয়াল

C/C++-এ ইনপুট বাফার ক্লিয়ার করা


fflush(stdin) ফাংশনটি স্ট্রিমের আউটপুট বাফার ফ্লাশ বা ক্লিয়ার করতে ব্যবহৃত হয়। scanf()-এর পর ব্যবহার করলে, এটি ইনপুট বাফারও ফ্লাশ করে। সফল হলে শূন্য রিটার্ন করে, অন্যথায় EOF রিটার্ন করে এবং feof এরর ইন্ডিকেটর সেট হয়।

C ভাষায় ইনপুট বাফার ক্লিয়ার করার জন্য fflush(stdin)-এর সিনট্যাক্স:

int fflush(FILE *stream);

C ভাষায় ইনপুট বাফার ক্লিয়ার করার fflush(stdin) উদাহরণ:

উদাহরণ

#include <stdio.h>
#include <stdlib.h>
int main() {
    char s[20];
    printf("Enter the string: \n", s);
    scanf("%s\n", s);
    printf("The entered string: %s", s);
    fflush(stdin);
    return 0;
}

আউটপুট

Enter the string: helloworld
The entered string: helloworld

  1. সি/সি++-এ isblank() ফাংশন

  2. সি-এ fflush(stdin) ব্যবহার

  3. সি/সি++-এ বারkeley-এর অ্যালগরিদম

  4. C++-এ BST-এ Two Sum IV (Two Sum IV - Input is a BST)