This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
Hi, I have a question on RandomAccessFile class in java.io package. Using this class if we open a exisitng file in "rw" mode and write some data ,it always seems to overwrite the existing file. Am I right ? Is there any way to make it append to a file ? Thanks Milind
Yes, it will overwrite because on opening the file the pointer will always be set at the beginning of the file. To append you need to move the pointer to the end of the file first before writing: If f is your file reference then f.seek(f.length()); should do it. Andrew