Howto interpret method param as verbatim string? 
Author Message
 Howto interpret method param as verbatim string?

Hi,

Is it possible to interpret regular strings as verbatim strings after
they're passed as method parameters?

For example, I am pulling a string, that represents a command line, from an
XML file. It might be stored in the the XML file like this:

C:\Windows\Notepad.exe C:\SomeDir\Test.txt

It's passed to a method as a single string. I want to be able to use that
string as a verbatim string. How can I do that since I'm reading the value
from a file?

Thanks,
Dan



Mon, 13 Dec 2004 23:27:42 GMT  
 Howto interpret method param as verbatim string?
Dan,

    I think you might have something confused.  The representation of
strings in variables is always the same.  However, the declaration of
literal strings can be done the normal way, or you can declare them using
verbatim strings.  In the end, it is stored internally the same way.  So,
basically you can have:

// A string variable.
string pstrString = null;

// Make an assignment.
pstrString = "Hello\\There";

// Make another assignment.  This is the same as the first, and is in fact,
the same string.

    Hope this helps.

--
               - Nicholas Paldino [.NET MVP]


Quote:
> Hi,

> Is it possible to interpret regular strings as verbatim strings after
> they're passed as method parameters?

> For example, I am pulling a string, that represents a command line, from
an
> XML file. It might be stored in the the XML file like this:

> C:\Windows\Notepad.exe C:\SomeDir\Test.txt

> It's passed to a method as a single string. I want to be able to use that
> string as a verbatim string. How can I do that since I'm reading the value
> from a file?

> Thanks,
> Dan



Mon, 13 Dec 2004 23:53:05 GMT  
 Howto interpret method param as verbatim string?
Dan, do you mean verbatim so that the \ isn't read as an escape character?

string literal.

--
Greg
http://www.claritycon.com/


Quote:
> Hi,

> Is it possible to interpret regular strings as verbatim strings after
> they're passed as method parameters?

> For example, I am pulling a string, that represents a command line, from
an
> XML file. It might be stored in the the XML file like this:

> C:\Windows\Notepad.exe C:\SomeDir\Test.txt

> It's passed to a method as a single string. I want to be able to use that
> string as a verbatim string. How can I do that since I'm reading the value
> from a file?

> Thanks,
> Dan



Tue, 14 Dec 2004 00:04:14 GMT  
 Howto interpret method param as verbatim string?
Hi Nicholas,

Thanks for taking the time to reply. I guess I was confused. As it turns
out, the strings are represented correctly when read from the XML file.

Dan



Quote:
> Dan,

>     I think you might have something confused.  The representation of
> strings in variables is always the same.  However, the declaration of
> literal strings can be done the normal way, or you can declare them using
> verbatim strings.  In the end, it is stored internally the same way.  So,
> basically you can have:

> // A string variable.
> string pstrString = null;

> // Make an assignment.
> pstrString = "Hello\\There";

> // Make another assignment.  This is the same as the first, and is in
fact,
> the same string.

>     Hope this helps.

> --
>                - Nicholas Paldino [.NET MVP]




Tue, 14 Dec 2004 00:39:03 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Howto: Interpret the VC++ 5.0 *.map file?

2. Howto: Interpret the VC++ 5.0 *.map file?

3. Custom Interface [out] param in an event method

4. BUG?:cl.exe error when exporting std::string default param

5. VB + C DLL: Probs filling String param.

6. Passing String Param to COM object

7. Howto pass array of char as input for method

8. HowTo invoke a method in a different thread?

9. Howto Expose a normal C++ class with methods via an Interface Class in ATL COM

10. Howto create method with default values?

11. Howto define ado2.7 seek method's multi-column search variant

12. How do I fill DISPPARAM when calling method + 1 string param ?

 

 
Powered by phpBB® Forum Software