I'm fairly new to c++, but I'm running across a problem that I can't
seem to resolve.
Whenever I add the character literal \' (ie single quote) to a str ing
I get a runtime error. It compiles just fine, but errors at runtime.
for example:
string s;
s = "Hello, I\'m confused";
compiles but gives me a runtime error.
I'm developing using VC++ in Visual Studio 2005.
Any help is appreciated.
M Kulangara 5 1319 Ru********@gmail.com wrote:
I'm fairly new to c++, but I'm running across a problem that I can't
seem to resolve.
Whenever I add the character literal \' (ie single quote) to a str ing
I get a runtime error. It compiles just fine, but errors at runtime.
for example:
string s;
s = "Hello, I\'m confused";
compiles but gives me a runtime error.
I'm developing using VC++ in Visual Studio 2005.
This is covered by the FAQ 5.8.
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask Ru********@gmail.com wrote:
I'm fairly new to c++, but I'm running across a problem that I can't
seem to resolve.
Whenever I add the character literal \' (ie single quote) to a str ing
I get a runtime error. It compiles just fine, but errors at runtime.
for example:
string s;
s = "Hello, I\'m confused";
compiles but gives me a runtime error.
You have an error on line 42 of your program.
Victor referred you to FAQ 5.8, which essentially says "You didn't give
us enough info".
What errors are you getting? What results were you expecting? Where is
a complete, compilable example that exhibits the behavior that you are
asking about?
Thanks for the responses.... this string was passed to sql server. Of
course signlequotes must be doubled in this case. Changed and it is
now fixed.
Regards,
M Kulangara
On Jan 25, 11:53 am, red floyd <no.s...@here.dudewrote:
Rutgers...@gmail.com wrote:
I'm fairly new to c++, but I'm running across a problem that I can't
seem to resolve.
Whenever I add the character literal \' (ie single quote) to a str ing
I get a runtime error. It compiles just fine, but errors at runtime.
for example:
string s;
s = "Hello, I\'m confused";
compiles but gives me a runtime error.You have an error on line 42 of your program.
Victor referred you to FAQ 5.8, which essentially says "You didn't give
us enough info".
What errors are you getting? What results were you expecting? Where is
a complete, compilable example that exhibits the behavior that you are
asking about?
Ru********@gmail.com wrote:
>Thanks for the responses.... this string was passed to sql server. Of course signlequotes must be doubled in this case. Changed and it is now fixed.
I think that the reason you got an error at run time is that that's
when the string constant is evaluated. And in the evaluation, it hit
"\'". The backslash is the escape character, so it looks at the next
character to figure out what to do. But backslash-single quote is not
an escape sequence it knows about, so it complains.
Single quote doesn't need to be escaped.
--
Tim Slattery Sl********@bls.gov http://members.cox.net/slatteryt
On Jan 26, 10:12 am, Tim Slattery <Slatter...@bls.govwrote:
>I think that the reason you got an error at run time is that that's
when the string constant is evaluated. And in the evaluation, it hit
"\'". The backslash is the escape character, so it looks at the next
character to figure out what to do. But backslash-single quote is not
an escape sequence it knows about, so it complains.
Escape codes in string literals are processed at compile time.
Since the compiler didn't say anything, probably it just treated the
sequence as an unescaped quote mark.
The actual error was caused by something else, as described
by the OP in the post which you replied to (ie. he was passing
it to a third party API which was not expecting it). This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Paul Mateer |
last post by:
Hi,
I have been running some queries against a table in a my database and
have noted an odd (at least it seems odd to me) performance issue.
The table has approximately 5 million rows and...
|
by: George Hester |
last post by:
Please take a look at this google artcle:
http://groups.google.com/groups?hl=en&lr=&frame=right&th=55d6f4b50f5f9382&seekm=411f370d%241%40olaf.komtel.net#link9
The op was having trouble with...
|
by: Anthony Cuttitta Jr. |
last post by:
We have an application that outputs several different graphs from data
downloaded from our AS400. The application has worked without (this)
issue for several months now, but just recently, the...
|
by: Kevin Spencer |
last post by:
Hi all,
I am working on a service that uploads METAR weather information to the
National Weather Service FTP site. The service I'm authoring is hosted on a
Windows 200 server, and the NWS FTP...
|
by: Ben Rush |
last post by:
Hello World,
Okay, I have spent the day browsing the newsgroups and reading up on
article after article concerning ViewState corruption and so forth, and I
have a couple questions. We...
|
by: Robert |
last post by:
I have a series of web applications (configured as separate applications) on
a server.
There is a main application at the root and then several virtual directories
that are independant...
|
by: Charles Leonard |
last post by:
I am having yet another issue with Windows Server 2003. This time, the web
service (a file import web service) appears to run except for one odd
message: "ActiveX component can't create object". ...
|
by: Paul |
last post by:
Hi,
I've been struggling with this today, I'm developing a DotNet2.0 website in C# that needs to call a long running data query. Obviously this is a good candidate for an Asynchronous call, so...
|
by: AlekseyUS |
last post by:
Hi, I'm a little stuck,
I basically need to copy all the information within a specific file in Temp and append it to a file in another location.
I'm not having any problems with smaller size...
|
by: SAL |
last post by:
Hello,
I'm trying to include a popup in the ItemTemplate of a gridview row. The
ItemTemplate for the field contains a textbox and when the user clicks in
the textbox I want a popup panel to show...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| |