Suppose you have just opened a file pFile on permit request records with the following data formats COP2510 84652123 pending COP3514 17680087 approved ...(more data) The first field in a row is the course id, the second is the student id, the third is the status of the request (pending or approved). What statement is correct for reading a row of data? Assume student_id is an int variable, course_id is a string variable, and status is a string variable.

Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter7: File Handling And Applications
Section: Chapter Questions
Problem 15RQ
icon
Related questions
Question

Is it correct?

Suppose you have just opened a file pFile on permit request records with the following data
formats
COP2510 84652123 pending
COP3514 17680087 approved
...(more data)
The first field in a row is the course id, the second is the student id, the third is the status of the
request (pending or approved).
What statement is correct for reading a row of data? Assume student_id is an int variable,
course_id is a string variable, and status is a string variable.
fscanf(pFile, "%s %d %s", course_id, &student_id, status);
fscanf(pFile, "%s %d %s", course_id, student_id, status);
fscanf(pFile, "%s %d %s", &course_id, student_id, &status);
O fscanf(pFile, "%s %d %s", &course_id, &student_id, &status);
Transcribed Image Text:Suppose you have just opened a file pFile on permit request records with the following data formats COP2510 84652123 pending COP3514 17680087 approved ...(more data) The first field in a row is the course id, the second is the student id, the third is the status of the request (pending or approved). What statement is correct for reading a row of data? Assume student_id is an int variable, course_id is a string variable, and status is a string variable. fscanf(pFile, "%s %d %s", course_id, &student_id, status); fscanf(pFile, "%s %d %s", course_id, student_id, status); fscanf(pFile, "%s %d %s", &course_id, student_id, &status); O fscanf(pFile, "%s %d %s", &course_id, &student_id, &status);
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
File Input and Output Operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning