Questions tagged [nul]

NUL is the abbreviation for the null character in several character sets

NUL has a value of 0 and is often written as the escape sequence \0. It is used as a terminator in standard strings.

179 questions
36
votes
5 answers

Java string replace and the NUL (NULL, ASCII 0) character?

Testing out someone elses code, I noticed a few JSP pages printing funky non-ASCII characters. Taking a dip into the source I found this tidbit: // remove any periods from first name e.g. Mr. John --> Mr John firstName =…
praspa
  • 624
  • 2
  • 7
  • 12
25
votes
2 answers

C# Generics: If T is a return type, can it also be void? How can I combine these interfaces together?

I have the following interface that returns the generic parameter of type T using a callback... public interface IDoWork { T DoWork(); } however I also have the following interface as well, but it won't invoke a callback since it returns…
makerofthings7
  • 60,103
  • 53
  • 215
  • 448
21
votes
5 answers

Is '\0' guaranteed to be 0?

I wrote this function in C, which is meant to iterate through a string to the next non-white-space character: char * iterate_through_whitespace(unsigned char * i){ while(*i && *(i++) <= 32); return i-1; } It seems to work quite well, but…
Paul
  • 139,544
  • 27
  • 275
  • 264
21
votes
1 answer

nul bytes in regexp MATLAB

Can someone explain what MATLAB is doing with nul bytes (x00) in regular expressions? Examples: >> regexp(char([0 0 0 0 0 0 0 1 0 0 10 0 0 0]),char([0 0 0 0 46 0 0 10])) ans = 1 % current 4 % expected >> regexp(char([0 0 0 1 0 0 0 1 0…
horriblyUnpythonic
  • 853
  • 2
  • 14
  • 34
19
votes
4 answers

Passsing null byte via format specifier in `printf`

Why does printf print a space instead of stopping when I use the NULL character from the ASCII table? This is what I mean: printf("Hello%c, world", 0); //Hello , world printf("Hello%c, world", '\0'); //Hello , world Only when I put the escape…
sofia.bul
  • 219
  • 2
  • 6
16
votes
3 answers

How to 'cut' on null?

Unix 'file' command has a -0 option to output a null character after a filename. This is supposedly good for using with 'cut'. From man file: -0, --print0 Output a null character ‘\0’ after the end of the filename. Nice to cut(1)…
philcolbourn
  • 4,042
  • 3
  • 28
  • 33
14
votes
4 answers

Could sed or awk use NUL character as record separator?

I have a NUL delimited output coming from the following command : some commands | grep -i -c -w -Z 'some regex' The output consists of records of the format : [file name]\0[pattern count]\0 I want to use text manipulation tools, such as sed/awk,…
user1129812
  • 2,859
  • 8
  • 32
  • 45
14
votes
4 answers

How should character arrays be used as strings?

I understand that strings in C are just character arrays. So I tried the following code, but it gives strange results, such as garbage output or program crashes: #include int main (void) { char str [5] = "hello"; puts(str); } Why…
Lundin
  • 195,001
  • 40
  • 254
  • 396
12
votes
2 answers

Python - how to read file with NUL delimited lines?

I usually use the following Python code to read lines from a file : f = open('./my.csv', 'r') for line in f: print line But how about if the file is line delimited by "\0" (not "\n") ? Is there a Python module that could handle this ? Thanks…
user1129812
  • 2,859
  • 8
  • 32
  • 45
12
votes
2 answers

How can I write to the NUL device under Windows from node.js?

This is bugging me for several days now. I know about the standard stream redirection to the NUL device, but this isn't the case. node.js uses CreateFileW under its fs native/libuv bindings. Unfortunately using something…
SaltwaterC
  • 372
  • 4
  • 11
10
votes
1 answer

Python bug: null byte in input prompt

I've found that input('some\x00 text') will prompt for some instead of some text. From sources, I've figured out that this function uses C function PyOS_Readline, which ignores everything in prompt after NULL byte. From PyOS_StdioReadline(FILE…
Kostya Cholak
  • 192
  • 1
  • 10
8
votes
2 answers

How to handle empty rows in CROSS APPLY [SQL Server]

I've below Stored Procedure- ALTER PROCEDURE [dbo].[Optimized_GetArticlePostAMP] ( @PostID int …
user5426326
7
votes
1 answer

Null byte stops for `print` but not `strlen`, why?

I was playing around with Dart strings and noticed this: print("\x00nullbyte".length); print("\x00nullbyte"); If you run this, you'll find that the length is 9, which includes the null byte. But there is no output. Trusting Google engineers more…
conradkleinespel
  • 6,560
  • 10
  • 51
  • 87
6
votes
1 answer

Failed to create Release artifact directory (Access to the path 'C:\agent\_work\r1\a\NUL' is denied.)

Lately we face an annoying problem with our build agents (2 seperately installed machines running Windows 2016) with the VSTS build agent installed. When we run del "\\?\%CD%\nul" (see Super User) it works for a couple of builds and then appears…
Luuk
  • 1,959
  • 1
  • 21
  • 43
1
2 3
11 12