nul

allow user to complete parallel / xargs command (function) after selecting files into array; quoting nuls correctly in printf script

你说的曾经没有我的故事 提交于 2020-02-25 04:06:50
问题 This is a follow-on question to this question In that question, I could get selected files into an array and pass them to a command / function (already exported). This question differs in that I would like the user to complete the command after selecting the files. The filenames can have spaces in them; hence the choice of Null-separated. I'm using FZF to select the files. It produces an array containing nul-ending filenames, I think. But the first item that FZF produces is the name of a key

Is skipping/ignoring NUL bytes on process substitution standardized?

余生长醉 提交于 2020-01-25 01:48:18
问题 Executive Summary Is it standard behavior that shells skip over NUL bytes when doing process substitution? For example, executing printf '\0abc' | read value && echo $value will yield abc . The NUL value is skipped, even though the hexdump of the printf output shows it's clearly being output. My first thought was " word splitting ". However, when using an actual process substitution value=$(printf '\0abc') the results are similar and = does not perform word splitting. Long Story While

Using >nul in a variable

泄露秘密 提交于 2020-01-24 19:50:21
问题 Does anyone know how to stop >nul being ignored when set in a variable, or is this not possible? I have a feeling that it's one of those things that will only work once all variables have been expanded or something, but it can't hurt to ask. Example: @echo off :: Won't work SET pause_5=ping localhost /n 6 >nul %pause_5% :: Will work SET pause_5=ping localhost /n 6 %pause_5% >nul exit 回答1: Put quotes around the argument: set "pause_5=ping localhost /n 6 >nul" Another option is to escape

Is NUL set automatically, if I provide an extra element for it in the declaration of the respective char array?

被刻印的时光 ゝ 提交于 2020-01-16 13:12:33
问题 Is '\0' set automatically if I provide an extra element for it, but left it in the initialization string? Like: char a[6] = {"Hello"}; // <- Is NUL set here automatically? I´ve did one experiment with C and C++:` C: #include <stdio.h> int main() { char NEWYEAR[16] = {"Happy New Year!"}; printf("%s\n",NEWYEAR); return 0; } Output: Happy New Year! C++: #include <iostream> int main() { char NEWYEAR[16] = {"Happy New Year!"}; std::cout << NEWYEAR << std::endl; return 0; } Output: Happy New Year!

C# ReadKey crashing console app when called using <nul

社会主义新天地 提交于 2020-01-13 09:22:09
问题 So I decided to start programming in C#, and one of the things I did was to create a "pausec.exe" (a pause.exe clone). It works, but when calling it like: < nul pausec ...it crashes. The error I get - translated from Spanish to the best of my knowledge - goes like this: Unhandled exception: System.InvalidOperationException: Can't read keys when any of the applications doesn't have a console or when the console input has been redirected from a file. Try with Console.Read. And the stacktrace

unwanted “NUL” characters string after reading bytes of a mjpg TCP stream

為{幸葍}努か 提交于 2020-01-06 12:42:34
问题 I'm trying to record a jpeg image sent by an Ethernet camera in a mjpg stream. The images I obtain with my Borland C++ application (VSPCIP) are sometimes "corrupted" : I have the example of a "corrupted jpeg frame" : it has 21690 characters (for a 640x480 jpeg image) and among them there is a string of 5045 following characters which have the value "NUL" (displayed as NUL in Notepad++). And because I stop reading bytes when I reach the "content-length" specified in the mjpg header, the

yielding items from NUL separated input in python

Deadly 提交于 2020-01-04 05:39:15
问题 I have a situation in python where I need to loop items from a NUL separated stream given in a format similar to the output of find /somewhere -print0 The stream is binary, items can consist of all bytes except NUL There is no way of knowing if the whole thing would fit in the available memory (assume the stream can be infinite). There is no way of knowing the length of the individual items (assume it could always be longer than READ_SIZE in my current solution below). I feel like I'm missing

How should character arrays be used as strings?

大兔子大兔子 提交于 2019-12-29 07:35:13
问题 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 <stdio.h> int main (void) { char str [5] = "hello"; puts(str); } Why doesn't this work? It compiles cleanly with gcc -std=c17 -pedantic-errors -Wall -Wextra . Note: This post is meant to be used as a canonical FAQ for problems stemming from a failure to allocate room for a NUL terminator when declaring a string. 回答1: A C

In SQL Server, replace a Char(0), the null character, embedded in a string with its hex code

谁说我不能喝 提交于 2019-12-23 12:40:23
问题 What is a construct in SQL Server T-SQL that will replace a Char(0) , the null character, embedded in a string with its hex code? I.e. REPLACE('t'+Char(0)+'t', Char(0), REPLACE(master.dbo.fn_varbintohexstr(0), '000000', '')) does not return 't0x00t' , what does? (This does already work for 1 through 31.) This question has answers explaining the problem is the Collation. This answer shows master.dbo.fn_varbintohexstr(0) will return 0x00000000 . When I manually simplified the inner Replace to

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

梦想的初衷 提交于 2019-12-21 07:55:46
问题 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 like: require('fs').writeFileSync('NUL', 'foo') creates a NUL file into the cwd that has 3 bytes. I tried writing to the \Device\Null, but since I'm pretty much a *nix head where everything is a file, I failed to actually find a working path for \Device\Null. Such as \\.