Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Character Escape Sequence in a 'Load Object ' filename?

Author
Message
Scraggle
Moderator
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 24th Feb 2008 18:35 Edited at: 24th Feb 2008 19:36
OK, bear with me. I have only started trying to get my head around C++ today.

I wrote a small bit of code that does nothing at the moment but I get these three warnings:


The line that they refer to is:


Where oShip is: #define oShip 1

The warnings are obviously refering to the first character after each backslash ... but why?

As far as I can tell that should load a dbo object but it doesn't ... what I am not doing or what am I doing that I shouldn't be?

Thanks



Benjamin
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 24th Feb 2008 18:58
The backslash is used for escape sequences (such as \n = newline, \t = tab, etc). Either use two backslashes together or use forward slashes.

GTmauf
16
Years of Service
User Offline
Joined: 11th Feb 2008
Location:
Posted: 24th Feb 2008 18:58
Ok, I can only give a hint in the right direction about your problem.

When you put:


The "\"'s after a beginning " escape you from that string literal in the case you need to do something to the end of that string. So for instance \n is an escape sequence used to "end the line."

Now i'm not sure exactly how to handle it in C++ but in C# for example you would have to do something like this



In C++ you may have to do something differently though. Sorry if that was confusing, I hope it helped you understand where your problem lies
kBessa
18
Years of Service
User Offline
Joined: 8th Nov 2006
Location: Manaus, Amazonas, Brazil
Posted: 24th Feb 2008 18:58 Edited at: 24th Feb 2008 18:59
In C++ the backslash means a escape caracter on the string, like n means a newline, t means a tab, etc.

Just add a second backslash, like this: \
And you'll be fine!

[edit]Posted at the same time as Benjamin... [/edit]
Scraggle
Moderator
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 24th Feb 2008 19:36
Three simultaneous posts!

Thanks guys!



jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 25th Feb 2008 03:25
Wow... 3 Simultaneous posts - a Record I bet!

I personally use forward slash - you only need ONE - and YES it works in windows.

kBessa
18
Years of Service
User Offline
Joined: 8th Nov 2006
Location: Manaus, Amazonas, Brazil
Posted: 25th Feb 2008 04:17
I don't know if VC++ supports it, but in VC# I always put a @ before my string, like: @"c:\MyGame\MyMedia\MyImage.jpg" and it ignores escape sequences

Login to post a reply

Server time is: 2024-11-20 03:51:58
Your offset time is: 2024-11-20 03:51:58