Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Unrecognized escape sequence error

Posted on 2006-04-05
Medium Priority
Last Modified: 2008-02-07
Hi Guys,
             I would like to assign the string object m_sDestFile the following value

string m_sDestFile="c:\20060404.acct_balances.csv.TDAM.pgp";

but it underscores the 2 in 200060404 with "Unrecognized escape sequence " error message  

How do I avoid that?

Question by:Autofreak
LVL 86

Accepted Solution

Mike Tomlinson earned 200 total points
ID: 16386617
You need to put an "@" symbol in front of your string:

    string m_sDestFile=@"c:\20060404.acct_balances.csv.TDAM.pgp";

Assisted Solution

mmarksbury earned 200 total points
ID: 16386633
A few ways...

You can use an @ symbol before the quoted string which ignores the escape characters inside the quotes

Exa:  string m_sDestFile=@"c:\20060404.acct_balances.csv.TDAM.pgp";   <-- Notice the @


You can use the \ character to escape special characters.

Exa: string m_sDestFile="c:\\20060404.acct_balances.csv.TDAM.pgp";  <-- Notice the extra \

Assisted Solution

ositear earned 200 total points
ID: 16444611
Strings in C++ and c# has some "special codes". When you actually need to print literally those codes you need to escape them. Escape codes always start with a \ char.

In your case you have to escape the \ with another \, soy you need to write:

string m_sDestFile="c:\\20060404.acct_balances.csv.TDAM.pgp";  

Here are the most common escape sequences:

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

581 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question