String content within " "

How to use the content of a string variable within " ".

eg.
  int testfound = fd.find("From user argv[1]");
----
simply I need the argument 1 to be substituted there. Is there any escape seq. like that...

any help will be appreciated.
--begin


beginAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

inprasCommented:
fd.find???
what is fd?
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
inprasCommented:
Sorry reject I was about to make it comment
hope U won't mind for this
0
beginAuthor Commented:
fd is a string which contains around 50 characters.
--begin
0
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

inprasCommented:
string U mean is it a character array ? or MFC CString?
0
inprasCommented:
pu the declaration of fd here Pl
0
inprasCommented:
if str is character array then use

char str[50];
strcpy(str, "From user ");
strcat(str, argv[1]);
fd.find(str);

Hope this helps
0
mikeblasCommented:
Just make sure that argv[] is 39 characters long, or less.

..B ekiM
0
beginAuthor Commented:
thanks to inpras.
0
jasonclarkeCommented:
it looks as if you are using the standard library string (good thing too, much less error prone), in which case you can just do:

int pos = fd.find(string("From user ") + argv[1]);

For more complicated substitutions you can use the stringstream class.
0
beginAuthor Commented:
thanks jasindarke, it worked pretty well.
--begin
0
beginAuthor Commented:
thanks jasondarke, it worked pretty well.
--begin
0
jasonclarkeCommented:
unfortunately you accepted someone elses answer, but glad it worked anyway.
0
beginAuthor Commented:
It seems you have assumed that from my typographical error, that i have accepted someone else's answer, but its not the truth. actually i have once again asked a typical question related to the first one but with a minimal change. hope i have graded your answer. post me if you have any comments. sorry for your feelings..
--begin
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C++

From novice to tech pro — start learning today.