Question

(Create a binary data file) Write a program to create a file named CreateBinaryFile.dat if it...

(Create a binary data file) Write a program to create a file named CreateBinaryFile.dat if it does not exist. Append new data to it if it already exists. Write 50 integers created randomly into the file using binary I/O.

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

Using C Programming language:-

1st image is the code for creating a Binaryfile.dat

1) .dat file can be opened by notepad.

2) In the program I generate the 50 numbers below 100 only.

3) You can generate any 50 values by changing the 100 to your desired value

ex:- 100000000 ( the program generates 50 values from your value).

4) You can change this in the line n=rand()%100+1.

5) 2nd image is the output

6) we cannot see the output in the compiler.

7) The program directly writes the output (50 random numbers) in the BinaryFile.dat

2nd image is the output

we cannot see the output in the compiler.

The program directly writes the output (50 random numbers) in the BinaryFile.dat

Add a comment
Know the answer?
Add Answer to:
(Create a binary data file) Write a program to create a file named CreateBinaryFile.dat if it...
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 to create a file named integerFile.txt if it does not exist. Write 100...

    Write a program to create a file named integerFile.txt if it does not exist. Write 100 integers created randomly into the file using text I/O. The random integers should be in the range 0 to 100 (including 0 and 100). Integers should be separated by spaces in the file. Read the data back from the file and display the data in increasing order This is what I have so far: import java.io.File; import java.util.Scanner; import java.io.PrintWriter; public class integerFile {...

  • 3 Dn Ent Write a python program to create a Dictionary named grade with the given...

    3 Dn Ent Write a python program to create a Dictionary named grade with the given items and do the below operations: i. 15 i. Create Dictionary with keys-{'Monday', 'Tuesday', 'Wednesday Thursday', 'Friday') ii. values-{1, 2, 3, 4, 5) ii. Now append another item with key-'Saturday') and value-(63 to the already created Dictionary and print it.

  • Write a line of code that will declare a file variable named data. Assuming that the...

    Write a line of code that will declare a file variable named data. Assuming that the variable data was correctly created in the previous problem, write a line of code that will associate the variable with a file named grades.txt that is being opened for reading. Assuming that grades.txt only contains integers, write a line of code that will use the variable data to read in the first integer and store in a variable named test1 that has already been...

  • C++ 1. Your program should use named string constant for the file name to open the...

    C++ 1. Your program should use named string constant for the file name to open the file. Do not add any path to the file name because the path on your computer is not likely to exist on the computer the instructor uses to grade the program. Points may be deducted if you don't follow this instruction. 2. Split statements and comments longer than 80 characters into multiple lines and use proper indentations for the split portions. (Lab2b.cpp) Write a...

  • Question 2: Assume that a text file containing a series of integers is named numbers.txt and...

    Question 2: Assume that a text file containing a series of integers is named numbers.txt and exists on the c:Temp. Write a program that reads all of the numbers stored in the file and calculates their total. In order to test this program, you may create a text file using notepad. No GUI is necessary. Name the program number.py

  • Using Spyder (or the IDE of choice), create a new file named Assignment1.py and write a...

    Using Spyder (or the IDE of choice), create a new file named Assignment1.py and write a Python program using the Editor that produces the following output: My name is Razan Abdelgalil. I am taking CIS 195 at Cabrini University. 1 + 1 = 2 (use an arithmetic operator for the calculation)

  • c++ program Notes 1. Your program should use named string constant for the file name to open the file. Do not add any pa...

    c++ program Notes 1. Your program should use named string constant for the file name to open the file. Do not add any path to the file name because the path on your computer is not likely to exist on the computer the instructor uses to grade the program. Points may be deducted if you don't follow this instruction. 2. Split statements and comments longer than 80 characters into multiple lines and use proper indentations for the split portions. 3....

  • Write a complete Java program in a file caled Module1Progrom.java that reads all the tokens from...

    Write a complete Java program in a file caled Module1Progrom.java that reads all the tokens from a file named dota.txt that is to be found in the same directory as the running program. The program should ignore al tokens that cannot be read as an integer and read only the ones that can. After reading all of the integers, the program should print all the integers back to the screen, one per line, from the smalest to the largest. For...

  • 1. Write a class named Employee that holds the following data about an employee in attributes:...

    1. Write a class named Employee that holds the following data about an employee in attributes: name, ID number, department, and job title. (employee.py) 2. Create a UML diagram for Employee class. (word file) 3. Create a program that stores Employee objects in a dictionary. Use the employee ID number as the key. (employee_App.py) The program should present a menu that lets the user perform the following actions: ✓ Look up an employee in the dictionary ✔ Add a new...

  • Write a program that performs the following: - Reads from the file "myfile.txt" using readlines() -...

    Write a program that performs the following: - Reads from the file "myfile.txt" using readlines() - Prints out the contents of the file "myfile.txt", that was read into a list by readlines(). Note that this should not look like a list, so you will need to loop through the list created by readlines and print the text. - Use the try/except method to create the file if it does not exist - If the file does not exist, prompt 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