• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Jeanne Boyarsky
  • Tim Cooke
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
Bartenders:

Null terminated string

 
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Thirumurugan Mylrajan
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry, the fields are followed by 32 and not 0x32 as mentioned above.

Thanks.
 
Ranch Hand
Posts: 1847
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Thirumurugan Mylrajan
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the clarification.
 
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 1847
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
no, since the spaces are padding.
 
My previous laptop never exploded like that. Read this tiny ad while I sweep up the shards.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic