Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Char array to String
Message
From
28/10/2004 10:28:53
 
 
To
All
General information
Forum:
ASP.NET
Category:
Other
Title:
Char array to String
Environment versions
Environment:
C# 1.1
OS:
Windows XP SP1
Miscellaneous
Thread ID:
00955286
Message ID:
00955286
Views:
50
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
Next
Reply
Map
View

Click here to load this message in the networking platform