• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Null terminated value

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys
I recently joined the group and start the developer certification process.

I read the previous conversation about what to use about to fill extra space end of each field if field value is not enough to fill all space.
I am little confused in requirements it clearly says null terminated if less than the maximum length for the field. but in db file provided they use (byte)32 which is space character. So do we need to fill extra space with character or initial file fields uses all space with trailing space characters and we should put (byte)0 into extra spaces

I understood as the first choice but people mentioned that they used the other approach. Can anybody clarify?

Thanks
 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are many discussions about the value to use for padding the strings (like here and here and here).

I think in the end it's a fairly simple decision (and one which is also easy to argument in the choices.txt): you get a file with spaces, so you use spaces for padding. I even think the null terminated is a left-over (from when the program was written in C/C++) and is only in the assignment to confuse you a little bit
 
Willie Smits increased rainfall 25% in three years by planting trees. Tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic