(Solved):1. Write a code segment that opens a file named MyName.txt, writes your first name to the file, and then closes the file. 2. Write a code segment that opens a file named MyName.txt, reads the first… View Answer…

 

Question

1. Write a code segment that opens a file named MyName.txt, writes your first name to the file, and then closes the file.

2. Write a code segment that opens a file named MyName.txt, reads the first line from the file, displays that line, and then closes the file.

3. Assume that the MyName.txt file is currently closed. Write a code segment that opens the file without erasing it, writes another name

Scroll to top