Question

c language Write a statement that opens the file “DAmaster.dat” for both reading and writing and...

c language

Write a statement that opens the file “DAmaster.dat” for both reading and writing and assigns the returned file pointer to nfPtr. Assume that the file contains machine readable (i.e. binary) data with fixed length records.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer:

FILE *nfPtr = fopen("DAmaster.dat", "rb+");

because rb+ is used for opening binary files for both reading and writing.

Add a comment
Know the answer?
Add Answer to:
c language Write a statement that opens the file “DAmaster.dat” for both reading and writing and...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a program that opens a file (with the open() system call) and then calls fork)...

    Write a program that opens a file (with the open() system call) and then calls fork) to create a new process. Can both the child and parent access the file descriptor returned by open() ? What happens when they are writing to the file concurrently, i.e., at the same time?

  • Reading and Writing Complete Files in C: The first part of the lab is to write...

    Reading and Writing Complete Files in C: The first part of the lab is to write a program to read the complete contents of a file to a string. This code will be used in subsequent coding problems. You will need 3 functions: main(), read_file() and write_file(). The main function contains the driver code. The read_file() function reads the complete contents of a file to a string. The write_file() writes the complete contents of a string to a file. The...

  • Need help with these questions in C programming: 9. What is the output of the following...

    Need help with these questions in C programming: 9. What is the output of the following code? int X[10]={0}; int N=4; for(int k=0; k<N:k++) X[k] = k*2: printf("%d", X[N/2]; 10. Write a single statement to accomplish each of the following. Assume that each of these statements applies to the same program. a. Write a statement that opens file "oldmast.dat" for reading and assigns the returned file pointer to ofPtr. b. Write a statement that opens file "trans.dat" for writing and...

  • Language: c++ Write a program that opens a file to read 20 floating point numbers and...

    Language: c++ Write a program that opens a file to read 20 floating point numbers and store the information in a 4 x 5 array. The program should do the following: a. Compute the average of each set of 5 values b. Determine the largest value of the 20 values c. Report the results; print the original matrix and average of each row, and the largest of the values in this function. d. At the end of the program prompt...

  • Language is C++ I am reading in data from a file. In the .txt file is...

    Language is C++ I am reading in data from a file. In the .txt file is a series of dates. I need help converting dates from the format "20-Apr-18" to the standard "4/20/18" I've gotten the rest taken care of, I just need help converting the dates from the file. Thank you.

  • C++ language utput after the code executes on that data set. Assume the input file opens...

    C++ language utput after the code executes on that data set. Assume the input file opens successfully. #include <fstream> #include «iostream> using namespace std; int main ) int n = 0; int m-0; double d 0.0; char c = '*' , ifstream fin; fin.open ("data.txt"): fin >>n >> m>>c>>d; return 0; 7. Data set: 57 2.5 Output Data set: 5 2.57 Output: Data set: 5 7 2.5 Output . Data set: 57 2.5 * Output:

  • Write a c++ program in that file to perform a “Search and Replace All” operation. This...

    Write a c++ program in that file to perform a “Search and Replace All” operation. This operation consists of performing a case-sensitive search for all occurrences of an arbitrary sequence of characters within a file and substituting another arbitrary sequence in place of them. Please note: One of the biggest problems some students have with this exercise occurs simply because they don’t read the command line information in the course document titled “Using the Compiler’s IDE”. Your program: 1. must...

  • 6. Code writing: There exists an input file named “students.txt” that contains student NetIDs and GPAs....

    6. Code writing: There exists an input file named “students.txt” that contains student NetIDs and GPAs. An example is shown on the right; the format is one student per line, with one or more spaces between the NetID and GPA. Write a complete C program that opens this file, inputs the data, and prints the NetID and GPA of every student with a GPA < 2.0; assume the file will open successfully. User-defined functions are not required, and arrays are...

  • C Programming 12 1 point We can write a large amount text data to a file...

    C Programming 12 1 point We can write a large amount text data to a file without punctuation and will be able to make sense of that data when looking at the file with notepad. True False 13 1 point a When calling the function to open a file in read mode can cause the contents of the file to be erased. True False 14 1 point Writing a struct to a binary file is similar to writing an integer...

  • c++ program8. Array/File Functions Write a function named arrayToFile. The function should accept three arguments:...

    c++ program8. Array/File Functions Write a function named arrayToFile. The function should accept three arguments: the name of a file, a pointer to an int array, and the size of the array. The function should open the specified file in binary mode, write the contents of the array to the file, and then close the file. Write another function named fileToArray. This function should accept three argu- ments: the name of a file, a pointer to an int array, and the size...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT