post  A question about strcat

devas (6)   Link to this post
i have a sample code like this:

char *pFilePath;

if(...) {
pFilePath = "../config/error.txt"
}

i want to inform user with a string like "INFO : Error file location is ../config/error.txt".

Now, how can i do this in the shortest way?

Thanks
Abramus (87)   Link to this post
printf("INFO : Error file location is %s", pFilePath);

or

cout << "INFO : Error file location is " << pFilePath;

Additionally, you should declare pFilePath as

const char * pFilePath;

or even better

string filePath;

This topic is archived - New replies not allowed.