Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Can I use Java data types such as Strings to represent file names instead of character arrays?

0
Posted

Can I use Java data types such as Strings to represent file names instead of character arrays?

0

Feel free to do so in your file system program. HOWEVER, you should be very careful in what get written out to the disk. Since each inode has space allocated for exactly 8 bytes to hold the file name, you should always write out 8 characters to disk, regardless of the file size. If your file name is shorter, the unused characters should have the ‘\0’ or spaces. Thus, if you use strings, you’ll need to make sure exactly 8 characters are written out, regardless of the string length. I recommend that you use character arrays instead of strings if possible.

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.