Archived

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

Kernoel

Why do i get an error with this?

Recommended Posts

Kernoel    122
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   
Guest Anonymous Poster
#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   
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
ncsu121978    1344
  
#define FILE_NAME "c:\\cdc-saver\\cdc.3ds"
g_Load3ds.Import3DS(&g_3DModel, FILE_NAME);



"I pity the fool, thug, or soul who tries to take over the world, then goes home crying to his momma."
- Mr. T

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
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
Lowas    122

you can also do this:

const char* FILENAME = "c:/cdc-saver/cdc.3ds";

totally unneccessary to use a #define for a string

Share this post


Link to post
Share on other sites
Kernoel    122
None of those sollutions work........ i tried...

i don''t understand this.... when i start the program the screen flickers, and it does nothing....

Share this post


Link to post
Share on other sites
Kernoel    122
To Lowas:

error C2664: ''Import3DS'' : cannot convert parameter 2 from ''const char *'' to ''char *''


????? i tried like you said.... ?????

Share this post


Link to post
Share on other sites