Error when trying to open a file

Emilio Chang 41 Reputation points
2022-03-08T02:52:54.057+00:00

Hello,
I'm working with SDL2/C++ on Visual Studio and I want to open an image, but this error show up on every attempt:
180862-od.png
180881-error.png

At the beginning, I thought the problem had to do with the path of the image, since it is saved on One Drive (I have had problems before because of that), but then, I created a temporary folder on 'Downloads' to save the images there (since One Drive does not intervene on 'Downloads'), but it did not work either

180833-screenshot-6.png

Can someone help me with that? Please! This SDL2 thing is driving me nuts haha. Also, I would like to know if there a way to remove that 'C:\x\One Drive\x' from my files paths, since I think is giving me problems. I already tried to pause the sync and remove One Drive from my laptop, but the path is still there.

Developer technologies C++
0 comments No comments
{count} votes

Accepted answer
  1. Sreeju Nair 12,666 Reputation points
    2022-03-08T05:30:37.667+00:00

    "\" is the escape character, so add an additiional \ to escape the "\" in the path.

    For e.g.
    "C:\Users\emili...."

    to be converted to

    "C:\Users\emili........."

    Hope this helps

    2 people found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. RLWA32 49,536 Reputation points
    2022-03-08T09:46:43.59+00:00

    The various ways in which Visual C++ can handle string literals is summarized with examples here - https://learn.microsoft.com/en-us/cpp/cpp/string-and-character-literals-cpp?view=msvc-170

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.