Skip to main content
0 votes
1 answer
107 views

printf returns 6 instead of 0 when assigning a null string

Why does printf function return 6 instead of 0 when assigning NULL as string to it, although its printing nothing? int main(void) { int x; x = printf("%s", NULL); printf ("\...
Dee A's user avatar
  • 3
-1 votes
1 answer
689 views

Unmarshalling a sql.NullTime struct in Go

Given type NullTime struct { Time time.Time Valid bool // Valid is true if Time is not NULL } and type PayinCount struct { DateShiftStart sql.NullTime `json:"dateShiftStart"`...
Keith John Hutchison's user avatar
1 vote
2 answers
413 views

jQuery serialize method returns null

I am trying to submit the form using jQuery but the serialize method returns null. What's going wrong? Help is very much appreciated. Here is my code. HTML / PHP code <TR> <FORM id="...
khagolsan's user avatar
0 votes
3 answers
75 views

How to pass a string to function and then check if it is equal to a string

#include <stdio.h> typedef struct ComplexNumber_S { float realNumber; float img; } ComplexNumber; /** * @brief gets a number * @return the input number */ float GetNumber() { float ...
אסף דוד הלל's user avatar
6 votes
2 answers
918 views

Why does [NullString]::Value evaluate differently with a breakpoint?

I've tried this code in PowerShell ISE and VS Code with the same strange result. Without a breakpoint, the output is EMPTY, but with a breakpoint in the line with "NULL", the output is NULL (as ...
andiDo's user avatar
  • 319
0 votes
1 answer
368 views

Simple string return function with default param passed as NULL, returns NULL instead of string

I have the following function: CREATE OR REPLACE FUNCTION public.get_string(cmd_type text, udf_name text, group_name character varying DEFAULT 'usage'::character varying) RETURNS text LANGUAGE ...
HuFlungPu's user avatar
  • 581
0 votes
0 answers
3k views

C++ Aborted with basic_string::_M_Construct null not valid

There are some questions with the same error but no one matches with my case. I have two classes: Loader and Processor. The loader loads a vector of string. The processor calls, in the constructor, ...
Yanet's user avatar
  • 181
15 votes
3 answers
31k views

JsonConvert.SerializeObject: Unexpected result when Serializing null value

In the line of code below, my string x ends up being an actual string "null" when clInitializer.AVOptions = null value: string x = JsonConvert.SerializeObject(clInitializer.AVOptions, new ...
concentriq's user avatar
8 votes
2 answers
6k views

C# 7 switch case with null checks

C#7 introduces a new feature called patterns, which you can use with Is-Expression or Switch cases like this: string str = null; switch(str){ case string x: Console.WriteLine("string " + ...
MAbdulHalim's user avatar
1 vote
1 answer
531 views

EnumDisplayDevices - passing null causes error

The MSDN documentation for EnumDisplayDevices states that passing NULL as the first parameter to the function returns information about the display adaptor(s) on the machine (passing a string returns ...
Harry Smith's user avatar
2 votes
1 answer
1k views

Passing null string value via environment variable to TSQL script

I have a DOS batch file I want to use to invoke a TSQL program. I want to pass the names of the databases to use. This seems to work. I want to pass the PREFIXES for the names of the tables I want to ...
elbillaf's user avatar
  • 1,994
9 votes
7 answers
19k views

String.IsNullOrEmpty(myString) Vs myString != null

Which one is better among these three? string myString = ""; String.IsNullOrEmpty(myString); vs string myString = ""; if(myString.Length > 0 || myString != null) vs string myString = ""; if (...
Asad's user avatar
  • 22k
1 vote
3 answers
3k views

Error with StringBuilder -- String Not Being Appended

Working with long strings and found this problem. Any advice? I have an instance where a string builder's Capacity is 1024 and Length is 992. I am .Append() a string that has a .Length property of ...
bobber205's user avatar
  • 13.4k