This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes null terminated text fields? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "null terminated text fields?" Watch "null terminated text fields?" New topic

null terminated text fields?

Henry Zheng
Ranch Hand

Joined: Jan 24, 2004
Posts: 60

I'm currently working with my assignment, and I got a problem regarding to the format of the text fields in the db file.

My assignment mandates all text fields be "null terminated if less than the maximum length for the field"(directly quoted from instructions).

But when I checked the original db file comes along with the assignment, I found that text fields are padded by spaces.

So should I pad the empty bytes with 0 or with white spaces? And do I need to consider the whitespace padding in the original records part of the fields(which is not sensible) or just rip them off?


Henry Zheng<br /> <br />I went numb when I learned to see.
Omar Kalaldeh
Ranch Hand

Joined: Jun 08, 2004
Posts: 58
Hi Henry,

I think the following link will help you,
URLyBird 1.3.3 data file: Reply from SUN

Padding strings with white spaces is completely accepted by sun, and it is the easiest way.

Best Regards <br /> <br />Omar F. Kalaldah<br />---------------------<br />SCJP, SCJD, SCBCD
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: null terminated text fields?
Similar Threads
NX: URLyBird 1.1.3 Find criteria
Null-terminated data entries.
B&S - Some more questions according the database (see third post)
Null terminated strings?
db file: fixed length fields termination characters