Questions tagged [null-character]

The null character, abbreviated NUL, is a control character with the value zero.

101 questions
0
votes
1 answer

BASH/Readline Verbatim Null Character

I'm trying to understand exactly who among the set of TTY, kernel, line discipline, and shell actually deals with any given part of my input. In particular, I've been working through this article: The TTY demystified My question: if I want to have…
0
votes
2 answers

Vim opens Powershell dump files with null characters

In Powershell I run some command-line script and make a dump of it: PS> cmd /c D:\script.bat | tee ~/out.log Then, I open this log in vim, and this is roughly what I see: яю^M^@ ^@C^@:^@\^@U^@s^@e^@r^@s^@>^@s^@e^@t^@…
zbstof
  • 1,052
  • 3
  • 14
  • 27
-1
votes
1 answer

How does a null character behave in a char array in C?

I tried to reverse this char array with null characters in the middle and the end, without using string length. (original code) #include #include int main() { char string[4] ={'c', '\0', 's', '\0'}; …
-1
votes
2 answers

How to get all characters including null characters('\0') from character pointer in C?

i have character pointer input and have set 50 bytes of memory for it. After i take input from keyboard using scanf , for example "apple" then i assume that remaining spaces are filled with null character. if it is so , how can i get all the…
Anonymous
  • 318
  • 4
  • 14
-1
votes
2 answers

third argument of the strncpy changes my local variable

char activeip[11]="0123456789"; char buffer[1001]; int MAX_SIZE = 1000; printf("MAX_SIZE %d\n", MAX_SIZE); strncpy(buffer, "string here....... ",MAX_SIZE+1); printf("MAX_SIZE %d\n", MAX_SIZE); strncpy(&buffer[strlen(buffer)],activeip,MAX_SIZE+1…
-1
votes
1 answer

Why has the '\0' been added in the following program?

I've been told the null character or ‍'\0' serves a purpose to identify the end of a string. But, I'm in a haze as I have come across two programs thus far, in which, there have been no usage of the same(null character). All three programs deal with…
Bao
  • 25
  • 1
  • 1
  • 10
-1
votes
4 answers

inserting a substring into another string in c

i just started learning c. i am doing an exercise and the question is as follows. Write a function called insertString to insert one character string into another string.The arguments to the function should consist of the source string, the string…
yash
  • 1,357
  • 2
  • 23
  • 34
-2
votes
2 answers

Calculate length of string without using strlen() function

Having a doubt regarding a very simple C code. I wrote a code to calculate the length of a string without using the strlen function. The code below works correctly if i enter a string with no spaces in between. But if i enter a string like "My name…
Sangeetha
  • 485
  • 2
  • 9
  • 24
-3
votes
1 answer

Why is there a difference between the size of these two arrays with the same characters in C?

I created two arrays 'TEST' and 'arr' below,both contain characters "ABCDE". #include #define TEST "ABCDE" int main() { char arr[5]; int i; for(i=0;i<5;i++) { arr[i] = i + 65; } printf("%s\n",arr); printf("%zd…
Sym Laq
  • 3
  • 1
-4
votes
1 answer

Why on earth is my file reading function placing null-terminators where excess CR LF carriages should be?

Today I tried to put together a simple OpenGL shader class, one that loads text from a file, does a little bit of parsing to build a pair of vertex and fragment shaders according to some (pretty sweet) custom syntax (for example, writing ".varying…
Tirous
  • 121
  • 1
  • 8
-7
votes
1 answer

How to avoiding nullchar converted to 0?

I have a char array that is filled with {'1','0','0','0'} for example, I apply atoi() on this array it returns 1000 which is true, however after I reset the array elements to null char '\0' and refill the array with 50 and apply atoi() again it…
1 2 3 4 5 6
7