Answers
3. java.io.FileDescriptor works for opening a file having a specific name. If there is any content present in that file it will first erase all that content and put “Beginning of Process” as the first line. Instances of the file descriptor class serve as an opaque handle to the underlying machine-specific structure representing an open file, an open socket, or another source or sink of bytes.
- The main practical use for a file descriptor is to create a FileInputStream or FileOutputStream to contain it.
- Applications should not create their own file descriptors.
4.
- Dynamically allocated block needs to be freed explicitly. Otherwise, it would lead to memory leak.
- Uninitialized pointers might cause segmentation fault.
- Arrays passed as a function parameter decay to a pointer to the first element of the array, obscuring whether the parameter is intended to point to an array or a single data element.