3.Which of the following will read a string from a  file with FILE* fpto char myString[81] properly (safely): fscanf(fp, "%s", myString ); fgets(myString, fp); fgets(fp, 81, myString); correct : fgets(myString, 81,fp) fscanf(fp,"%80s", myString); 4. If you issue the statement fpIn = fopen("myfile.dat", "a");and dat does not exist, the computer will: return NULLto fpIn as the file does not exist create the file in write mode, and position the file pointer at the beginning of the file create the file in write mode, close the file and return a warning open a file that most closely resembles the name 'myfile.dat'

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter8: I/o Streams And Data Files
Section8.4: File Streams As Function Arguments
Problem 3E
icon
Related questions
Question

3.Which of the following will read a string from a  file with FILE* fpto char myString[81] properly (safely):

    1. fscanf(fp, "%s", myString );
    2. fgets(myString, fp);
    3. fgets(fp, 81, myString); correct : fgets(myString, 81,fp)
    4. fscanf(fp,"%80s", myString);

4.

  • If you issue the statement fpIn = fopen("myfile.dat", "a");and dat does not exist, the computer will:
    1. return NULLto fpIn as the file does not exist
    2. create the file in write mode, and position the file pointer at the beginning of the file
    3. create the file in write mode, close the file and return a warning
    4. open a file that most closely resembles the name 'myfile.dat'
Expert Solution
trending now

Trending now

This is a popular 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
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT