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 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...

  • 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...

  • problem specification: writing in c++ language ... Question Problem Specification: Writing in c++ language write a...

    problem specification: writing in c++ language ... Question Problem Specification: Writing in c++ language write a program that will define a structure consisting of the following data members, “fields”: - name - hours worked - hourly rate Use a structure to implement the following: -Use a function to read the name, hours and rate, passing them by reference to the main function. -Call a function to print, this function accepts the entire structure by value. This function will call a...

  • Use C++ language. Write a program that gives and takes advice on program writing. The program...

    Use C++ language. Write a program that gives and takes advice on program writing. The program starts by writing a piece of advice to the screen and asking the user to type in a different piece of advice. The program then ends. The next person to run the program receives the advice given by the person who last ran the program. The advice is kept in a file, and the contents of the file change after each run of the...

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
ADVERTISEMENT