I have a destination path and a file name as strings and I want to concatenate them with c++.
Is there a way to do this and let the program/compiler choose between / and \ for windows or unix systems?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you wanted to do it at compile time you could certainly do something like
Or you could just use ‘/’ and things will work just fine on windows (except for older programs that parse the string and only work with ‘\’). It only looks funny if displayed to the user that way.