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.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Null terminated string Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Null terminated string" Watch "Null terminated string" New topic
Author

Null terminated string

Thirumurugan Mylrajan
Ranch Hand

Joined: Jan 26, 2006
Posts: 64
Hello,

I hava basic question. The following is a req.

All text values, and all fields (which are text only), contain only 8 bit characters, null terminated if less than the maximum length for the field. The character encoding is 8 bit US ASCII.

What is the meaning of "Null terminated" here. I see in the DB file that they provided have 0x32 after the values.

Should I end every string with a special character?.

Thanks.


SCJP , SCJD. (IBM 142 in progress).
Thirumurugan Mylrajan
Ranch Hand

Joined: Jan 26, 2006
Posts: 64
Sorry, the fields are followed by 32 and not 0x32 as mentioned above.

Thanks.
Jeroen T Wenting
Ranch Hand

Joined: Apr 21, 2006
Posts: 1847
it means that either the description of the file format as stated in the documentation is incorrect or you (and everybody else) have been supplied with a corrupt file.

The general consensus is (and I believe there's an old post confirming this by someone who asked Sun about it and actually got a reply) that the description in the assignment documentation is incorrect and in fact the data is padded with spaces instead of null values.

I've just mentioned that in my choices.txt, using a realworld situation in which something similar happened (file format specs as supplied by customer didn't match supplied test data, customer wanted us to go from the supplied data rather than the documentation) as justification.


42
Thirumurugan Mylrajan
Ranch Hand

Joined: Jan 26, 2006
Posts: 64
Thanks for the clarification.
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11437
    
  85

Originally posted by Jeroen T Wenting:
The general consensus is (and I believe there's an old post confirming this by someone who asked Sun about it and actually got a reply)...


FYI, I think the post Jeroen mentioned is this one.

Regards, Andrew


The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Josephx Rainerd
Greenhorn

Joined: Apr 27, 2006
Posts: 12
Hello

My B&S assignment datafile, has values padded with space though ,mentioned in spec, that length < max length needs to be null terminated.


I (so far) took the approach of padding with spaces)(ignoring spec and documenting the reason).

In my search screen, I return
'Fred' matches 'Freddy'
'Fred' DOES NOT match 'Freddy' for exact search
BUT 'Fred' matches 'Fred ' space padded for exact search

I do not see any way of distinguishing 'Fred' and 'Fred ' .

Is that going to upset Sun?

Also I let empty field (unless exact search) match all data. So all blank fields, in effect return all records.( I have a GUI element in screen) to chose 'Show all' also ).

Thanks
Jeroen T Wenting
Ranch Hand

Joined: Apr 21, 2006
Posts: 1847
no, since the spaces are padding.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Null terminated string