Re: Put ascii to char
"Marsh, Drew" <[email protected]>
| Newsgroups | gmane.comp.windows.devel.dotnet.general |
|---|---|
| Message-ID | <[email protected]> |
Eric Shiau [mailto:[email protected]] wrote: > I need to put non-printable characters to char. e.g., > > char escape=27; // which is Escape character > > above statement is valid on C/C++, but for C#, I got the > following error > > error CS0031: Constant value '27' cannot be converted to a 'char' > > Could anyone help me with this? Sure, you need to be explicit about the assignment and cast that's all. Try this instead: <codeSnippet language="C#"> char escape = (char)27; </codeSnippet> HTH, Drew [ .NET MVP | weblog: http://radio.weblogs.com/0104813/ ] You can read messages from the DOTNET archive, unsubscribe from DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.