Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Char array to String
Message
 
To
28/10/2004 10:28:53
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
C# 1.1
OS:
Windows XP SP1
Miscellaneous
Thread ID:
00955286
Message ID:
00955735
Views:
19
Jay,
new string( Test )
Is there any particular reason you're reading this data in chunks like this?


>Hi,
>
>Am I missing something simple? I want to convert an array of type char to a string of what is in the char buffer. This is the "long way", iterating through the char array:
>
>
>StreamReader sr = new StreamReader(cFile);
>
>char[] c = null;
>string cNextLine;
>
>while(sr.Peek() > -1)
>{
>    c = new char[80];
>    sr.Read(c, 0, c.Length);
>
>    cNextLine = "";
>
>    for (int i = 0; i < nRecordLength; i++)
>    {
>        cNextLine = cNextLine + c[i];
>    }
>
>    SomeFunctionUsingString(cNextLine);
>}
>sr.Close();
>
>
>Is there an easier way provided by the framework?
>
>Thanks,
>Jay
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform