Question
Download Solution PDFC में fscanf() का क्या उद्देश्य है?
Answer (Detailed Solution Below)
Detailed Solution
Download Solution PDFव्याख्या:
C में fscanf() फलन
परिभाषा: C में fscanf()
फलन का उपयोग फ़ाइल से स्वरूपित इनपुट पढ़ने के लिए किया जाता है। यह मानक I/O पुस्तकालय का हिस्सा है और डेटा को फ़ाइल से उसी तरह पढ़ने की अनुमति देता है जैसे scanf()
फलन मानक इनपुट (कीबोर्ड) से इनपुट पढ़ता है।
सिंटैक्स: fscanf()
फलन का सिंटैक्स इस प्रकार है:
int fscanf(FILE *stream, const char *format, ...);
यहाँ, FILE *stream
एक FILE
वस्तु का पॉइंटर है जो इनपुट स्ट्रीम को पहचानता है, const char *format
इनपुट के स्वरूप को निर्दिष्ट करता है, और इलिप्सिस (...
) अतिरिक्त तर्कों का प्रतिनिधित्व करता है जहाँ फ़ाइल से पढ़ा गया डेटा संग्रहीत किया जाएगा।
#include
int main() {
FILE *file;
int num;
float fnum;
file = fopen("data.txt", "r");
if (file == NULL) {
printf("Error opening file.\n");
return 1;
}
fscanf(file, "%d %f", &num, &fnum);
printf("Integer: %d, Float: %f\n", num, fnum);
fclose(file);
return 0;
}
इस उदाहरण में, fscanf()
फलन data.txt
फ़ाइल से एक पूर्णांक और एक फ़्लोटिंग-पॉइंट संख्या पढ़ता है और उन्हें क्रमशः num
और fnum
चरों में संग्रहीत करता है।
Last updated on Jun 16, 2025
-> RRB JE CBT 2 answer key 2025 for June 4 exam has been released at the official website.
-> Check Your Marks via RRB JE CBT 2 Rank Calculator 2025
-> RRB JE CBT 2 admit card 2025 has been released.
-> RRB JE CBT 2 city intimation slip 2025 for June 4 exam has been released at the official website.
-> RRB JE CBT 2 Cancelled Shift Exam 2025 will be conducted on June 4, 2025 in offline mode.
-> RRB JE CBT 2 Exam Analysis 2025 is Out, Candidates analysis their exam according to Shift 1 and 2 Questions and Answers.
-> The RRB JE Notification 2024 was released for 7951 vacancies for various posts of Junior Engineer, Depot Material Superintendent, Chemical & Metallurgical Assistant, Chemical Supervisor (Research) and Metallurgical Supervisor (Research).
-> The selection process includes CBT 1, CBT 2, and Document Verification & Medical Test.
-> The candidates who will be selected will get an approximate salary range between Rs. 13,500 to Rs. 38,425.
-> Attempt RRB JE Free Current Affairs Mock Test here
-> Enhance your preparation with the RRB JE Previous Year Papers.