Click here to Skip to main content
15,886,664 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How to implement WebSocket Client in C Pin
Parthi_Appu12-Apr-11 2:58
Parthi_Appu12-Apr-11 2:58 
AnswerRe: How to implement WebSocket Client in C Pin
Indivara12-May-11 19:03
professionalIndivara12-May-11 19:03 
GeneralRe: How to implement WebSocket Client in C Pin
Manu Dhundi12-Dec-11 8:55
Manu Dhundi12-Dec-11 8:55 
QuestionHow can I check if LPCTSTR is empty ? Pin
_Flaviu10-Apr-11 20:57
_Flaviu10-Apr-11 20:57 
AnswerRe: How can I check if LPCTSTR is empty ? Pin
Hans Dietrich10-Apr-11 21:10
mentorHans Dietrich10-Apr-11 21:10 
GeneralRe: How can I check if LPCTSTR is empty ? Pin
_Flaviu10-Apr-11 21:20
_Flaviu10-Apr-11 21:20 
AnswerRe: How can I check if LPCTSTR is empty ? Pin
Rajesh R Subramanian10-Apr-11 21:22
professionalRajesh R Subramanian10-Apr-11 21:22 
AnswerRe: How can I check if LPCTSTR is empty ? Pin
Rob Grainger10-Apr-11 23:44
Rob Grainger10-Apr-11 23:44 
In C and C++, strings are null-terminated. As such the last character will always be a NUL character (ASCII 0).

Consequently, any string (char*, const char*, LPTSTR, LPCTSTR etc.) can be checked for empty using:

LPCTSTR sz;
if (!sz[0]) { /* string is empty */ }


However, commonly you also need to check if the string pointer is null - this means that the pointer does not refer to a string at all, rather than that the string is empty:

LPCTSTR sz;
if (!sz) { /* string is null */ }


Commonly, the two must be used together to check for empty or null:
if (!sz || !sz[0]) { /* empty or null */ }

GeneralRe: How can I check if LPCTSTR is empty ? Pin
_Flaviu11-Apr-11 5:45
_Flaviu11-Apr-11 5:45 
GeneralRe: How can I check if LPCTSTR is empty ? Pin
Rob Grainger11-Apr-11 12:55
Rob Grainger11-Apr-11 12:55 
QuestionProblem Showing Enumerated Sound Devices in ComboBox [modified] Pin
Paul Hasler10-Apr-11 16:49
Paul Hasler10-Apr-11 16:49 
AnswerRe: Problem Showing Enumerated Sound Devices in ComboBox Pin
Hans Dietrich10-Apr-11 19:03
mentorHans Dietrich10-Apr-11 19:03 
GeneralRe: Problem Showing Enumerated Sound Devices in ComboBox Pin
Paul Hasler10-Apr-11 20:26
Paul Hasler10-Apr-11 20:26 
GeneralRe: Problem Showing Enumerated Sound Devices in ComboBox Pin
Hans Dietrich10-Apr-11 20:41
mentorHans Dietrich10-Apr-11 20:41 
GeneralRe: Problem Showing Enumerated Sound Devices in ComboBox Pin
Paul Hasler10-Apr-11 21:18
Paul Hasler10-Apr-11 21:18 
GeneralRe: Problem Showing Enumerated Sound Devices in ComboBox Pin
Hans Dietrich10-Apr-11 21:27
mentorHans Dietrich10-Apr-11 21:27 
GeneralRe: Problem Showing Enumerated Sound Devices in ComboBox Pin
Paul Hasler10-Apr-11 22:01
Paul Hasler10-Apr-11 22:01 
GeneralRe: Problem Showing Enumerated Sound Devices in ComboBox Pin
Hans Dietrich10-Apr-11 22:13
mentorHans Dietrich10-Apr-11 22:13 
Questionhow to set IE to open my file format? just like PDF files. Pin
refla10-Apr-11 16:08
refla10-Apr-11 16:08 
AnswerRe: how to set IE to open my file format? just like PDF files. Pin
Hans Dietrich10-Apr-11 19:06
mentorHans Dietrich10-Apr-11 19:06 
QuestionRedirecting output to DVI or HDMI. Pin
beastian10-Apr-11 4:34
beastian10-Apr-11 4:34 
AnswerRe: Redirecting output to DVI or HDMI. Pin
Code-o-mat10-Apr-11 11:37
Code-o-mat10-Apr-11 11:37 
GeneralRe: Redirecting output to DVI or HDMI. Pin
beastian13-May-11 4:28
beastian13-May-11 4:28 
GeneralRe: Redirecting output to DVI or HDMI. Pin
Code-o-mat13-May-11 4:30
Code-o-mat13-May-11 4:30 
Questionproblem to draw line in list control Pin
shashankacharya8-Apr-11 19:30
shashankacharya8-Apr-11 19:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.