cplusplus.com
C++ : Forum : General C++ Programming : A question about strcat
 
cplusplus.com
Information
Documentation
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs


post A question about strcat

devas (6)
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 (170)
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;
Topic archived. No new replies allowed.