?
Solved

Retrieving a string

Posted on 2003-03-13
8
Medium Priority
?
224 Views
Last Modified: 2010-04-17
i tried a simple c++ program:
i take a sample string:"c:\temp\work" and give this as an input.
i'd like to retrieve the string as such ,the problem  i face here is that i'm not able to get the same string as the characters adjacent to the backslash are deleted.
how to retrieve the string as such with the "\"?
0
Comment
Question by:LakshmiPrasad
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 8

Accepted Solution

by:
akshayxx earned 100 total points
ID: 8128233
r u trying this
char * c="c:\temp\work";

then its wrong .. u shud do like this

char * c="c:\\temp\\work";

0
 
LVL 8

Expert Comment

by:akshayxx
ID: 8128247
since single back slash '\' is escape character .. to assign a backslash character in the string .. u shud use double back slashes "c:\\ddd\\ccc"
0
 

Author Comment

by:LakshmiPrasad
ID: 8128978
i do know that '\' is esc character ,but the thing is i'm taking "c:\temp\work" from a UI,now i need to manipulate the string which i had obtained ,but the string format gets changed and i'm not able to reproduce the same .
I'm able to avoid this for '\a','\b'...'\v'which form the escape sequences ,but if '\c' etc comes ,i'm not able to retrieve
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 24

Assisted Solution

by:SunBow
SunBow earned 100 total points
ID: 8129481
Read a single character at a time. In the input file, you can delineate a string by personal method, such as (1) 1st char is length of string or (2)all characters are part of string until a terminator is reached, such as cr, nl, tab, or special character such as semicolon or comma (see also, comma delimited files). Each character read in is appended to priors until string is completed.
0
 
LVL 8

Expert Comment

by:akshayxx
ID: 8132880
u said u need to manipulate the string .. can u show how r u trying to manipulate.. as UI routines take care of the escape sequences ..
0
 

Expert Comment

by:CleanupPing
ID: 9447171
LakshmiPrasad:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 
LVL 8

Expert Comment

by:akshayxx
ID: 9448611
to completely solve the problem , we needed asker's feedback.
split between SunBow and akshayxx for the contribution
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

777 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