Posts

Showing posts from 2019

How to extend display for multiple monitors when connected to a remote computer

Image
The following blog post shows how to extend display for multiple monitors when connected to a remote computer: Open Remote Desktop Connection and enter the IP address of the remote computer. Click on Show Options. Click on Display tab. Checkbox "Use all my monitors for remote session".

Tricky Situation: strtod function converting strings to inf or nan

Image
This blog post discuss about a tricky situation which can happen when using strtod function. Strtod function interprets the contents of string as a floating point number and return its value as a double. The declaration of strtod function is as shown below: Declaration double strtod(const char*str, char **end) str ->  It represents the value of the string which is to be converted. end -> It is the reference to an already allocated object of type char* Similar to the post about atof function , strtod function also converts the string to inf or nan if the string starts with "inf" or "nan". This can cause downstream impacts if the converted value is passed to database. The following program depicts this issue: Similar Posts: Tricky Situation when using atof function Anonymous classes in C++ Sets in C++ made easy

Tricky Situation: Atof function converting strings to inf or nan

Image
This blog post says about a tricky situation when using atof function. The atof function converts a string argument to a floating point number. If the string to be converted starts with "inf" or "nan", the atof function converts the string to inf/nan instead of converting to 0. inf represents "Positive Infinity" and nan represents a value which is "Not a Number". For eg: The following strings will convert to inf when using atof function. Information -> inf Infection -> inf Influenza -> inf etc... The following strings will convert to nan when using atof function. Nanotechnology -> nan Nanogram -> nan etc... This issue can cause downstream impacts if you are using the converted values to be saved to database or other application. The following C++ program shows the above issue: This issue can be corrected by using a simple which checks if the string starts with inf and if so