Archived

This topic is now archived and is closed to further replies.

Kernoel

Why do i get an error with this?

Recommended Posts

I just figuered out one problem just to get the next one Here are two code snippets... why do i get an "warning C4129: ''c'' : unrecognized character escape sequence" warning???
  
#define FILE_NAME  "c:\cdc-saver\cdc.3ds"

g_Load3ds.Import3DS(&g_3DModel, FILE_NAME);
  
pls reply if you know! i need to get this finished TODAY.... Thx, Markus

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Use double \\ in a string literal

#define FILE_NAME "c:\\cdc-saver\\cdc.3ds"
g_Load3ds.Import3DS(&g_3DModel, FILE_NAME);

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Try #define FILE_NAME "c:\\cdc-saver\\cdc.3ds"

The error is caused because in c, the ''\'' character means that the next character is part of an escape sequence, to let the programmer output or input things they normally couldn''t. For example, \" writes a ''"'' to the screen.

So when you have ''\c'' it thinks you are trying to do an escape sequence, but there isn''t one for ''\c''. Putting in ''\\'' works because that is the escape sequence for ''\''.

Share this post


Link to post
Share on other sites