UNDERSTANDING COMPUTER FILES
FILE EXTENSIONS AND FILE TYPES
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
|
Yes!:-)
|
|
No!:-(
|
|
Either A or B
|
|
None of the above
|
Detailed explanation-1: -You can definitely open a file for reading more than once, either in the same program, or in different programs. It should have no effect on the program(s).
Detailed explanation-2: -It’s okay to ACCESS the file from two different programs, as long as you don’t try to MODIFY it from two different programs.
Detailed explanation-3: -The same file can be opened more than once in the same program (or in different programs). Each instance of the open file has its own file pointer that can be manipulated independently.
Detailed explanation-4: -no, generally it is not safe to do this! you need to obtain an exclusive write lock for each process–that implies that all the other processes will have to wait while one process is writing to the file.. the more I/O intensive processes you have, the longer the wait time.
Detailed explanation-5: -Yes, but why didn’t you just try it? (Might actually be OS dependent.) If you want multiple offsets within the file to read, mmap() may be an option too, depending on your OS. Then you can just index into the file using memory addresses.