insert null in unix files

Hi everybody,

How to add null values in unix file?

This is what was asked to me in an interview.

maybe:

cat /dev/zero > test.txt

or

cat /dev/null > test.txt

??

The previous poster should have said (for SH shells)

dd if=/dev/zero bs=1 count=<count> >> outfile.txt

Because you want to append some zero values. Cat'ing from /dev/null will give you nothing.

The other way, is if in you're vi/m, you can hit CTRL-V CTRL-@ to get a NUL character. You can also use perl to generate one.

thanks for the reply.

I am not getting what you guys have explained probably bcoz i am jst a beginner.

Once again i am making my question clear. how to add null value to a file?

just wanna create a file with nulls. i dont know whether you can do this unix that is why i need experts like you guyz to answer.

What do you mean by "adding null values to a file" ? What's the required output ?