Hi,
How do I check if a member of a struct is null?
I've tried:
if(ErrorInfo->TestName != NULL)
The above method returns true even when ErrorInfo->TestName contains nothing (debug shows it as 0xccccccc, "").
(!(strcspn(ErrorInfo->TestName, "") == 0))
The above method throws an access violation.
I've tried other ways too (strcmp etc but they are all throwing access violation).
ErrorInfo->TestName is of type char *.
The structure:
typedef struct
{
int ErrorCode; // the error code which will correspond to an error message
char *TestName; // the name of the current test
char *Command; // the command that caused the error
char ErrorText[0x50]; // an error message
char *ExpectedData; // the expected data
char *ReturnedData; // the returned data
} ErrorInformation;
Note: I can only use ANSI C library functions.
Any help appreciated.