Click here to Skip to main content
15,887,135 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: a windows API function to convert JPG into BMP Pin
V_shr25-Oct-07 11:31
V_shr25-Oct-07 11:31 
AnswerRe: a windows API function to convert JPG into BMP Pin
Paresh Chitte25-Oct-07 18:33
Paresh Chitte25-Oct-07 18:33 
QuestionEmpty array problem?! how to know if array empty or not? [modified] Pin
Gofur Halmurat25-Oct-07 9:51
Gofur Halmurat25-Oct-07 9:51 
AnswerRe: Empty array problem?! how to know if array empty or not? Pin
Jonathan [Darka]25-Oct-07 10:00
professionalJonathan [Darka]25-Oct-07 10:00 
GeneralRe: Empty array problem?! how to know if array empty or not? Pin
Gofur Halmurat25-Oct-07 10:02
Gofur Halmurat25-Oct-07 10:02 
GeneralRe: Empty array problem?! how to know if array empty or not? Pin
Mark Salsbery25-Oct-07 10:09
Mark Salsbery25-Oct-07 10:09 
GeneralRe: Empty array problem?! how to know if array empty or not? Pin
Jonathan [Darka]25-Oct-07 10:15
professionalJonathan [Darka]25-Oct-07 10:15 
AnswerRe: Empty array problem?! how to know if array empty or not? Pin
Mark Salsbery25-Oct-07 10:05
Mark Salsbery25-Oct-07 10:05 
Gofur Halmuratov wrote:
how do we know that is pch is ""? or not?


In general, C arrays don't have a length attached to them so it's up
to you to keep track of array lengths and array contents.

In this case, since you're working with C "strings", which are arrays of chars,
you can use strlen()...

if (0 == strlen(pch))
{
   // pch is empty
}

You can't compare C strings like this: 

   pch!=""  <-- wrong!  Here you're comparing two pointers!

You can use strcmp however:

if (0 = strcmp(pch, ""))
{
   // pch is empty
}


Mark



Mark Salsbery
Microsoft MVP - Visual C++

Java | [Coffee]

GeneralRe: Empty array problem?! how to know if array empty or not? Pin
Gofur Halmurat25-Oct-07 10:09
Gofur Halmurat25-Oct-07 10:09 
AnswerRe: Empty array problem?! how to know if array empty or not? Pin
S_Murali25-Oct-07 20:12
S_Murali25-Oct-07 20:12 
QuestionLoad a resource script Pin
Demian Panello25-Oct-07 7:50
Demian Panello25-Oct-07 7:50 
AnswerRe: Load a resource script Pin
Mattias G25-Oct-07 8:39
Mattias G25-Oct-07 8:39 
GeneralRe: Load a resource script Pin
Demian Panello25-Oct-07 9:13
Demian Panello25-Oct-07 9:13 
GeneralRe: Load a resource script Pin
Mattias G25-Oct-07 10:12
Mattias G25-Oct-07 10:12 
GeneralRe: Load a resource script Pin
Demian Panello25-Oct-07 10:27
Demian Panello25-Oct-07 10:27 
Questionin order read using ifstream, i have to add ofstream after than do not know why??? Pin
kreena25-Oct-07 6:58
kreena25-Oct-07 6:58 
QuestionUsing XML in MFC Pin
LCI25-Oct-07 6:54
LCI25-Oct-07 6:54 
AnswerRe: Using XML in MFC Pin
led mike25-Oct-07 7:06
led mike25-Oct-07 7:06 
GeneralRe: Using XML in MFC Pin
LCI25-Oct-07 7:12
LCI25-Oct-07 7:12 
GeneralRe: Using XML in MFC Pin
LCI25-Oct-07 7:13
LCI25-Oct-07 7:13 
GeneralRe: Using XML in MFC Pin
led mike25-Oct-07 7:38
led mike25-Oct-07 7:38 
AnswerRe: Using XML in MFC Pin
Chris Losinger25-Oct-07 7:21
professionalChris Losinger25-Oct-07 7:21 
QuestionRe: Using XML in MFC Pin
David Crow25-Oct-07 8:45
David Crow25-Oct-07 8:45 
AnswerRe: Using XML in MFC Pin
bob1697225-Oct-07 17:13
bob1697225-Oct-07 17:13 
GeneralRe: Using XML in MFC Pin
kanduripavan25-Oct-07 18:36
kanduripavan25-Oct-07 18:36 

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.