Click here to Skip to main content
16,007,814 members
Home / Discussions / C#
   

C#

 
AnswerRe: String Concatenation Pin
Ravi Bhavnani31-Dec-08 7:25
professionalRavi Bhavnani31-Dec-08 7:25 
AnswerRe: String Concatenation Pin
Guffa31-Dec-08 16:12
Guffa31-Dec-08 16:12 
Questionplz help me about this Algo Pin
wasimsharp30-Dec-08 22:00
wasimsharp30-Dec-08 22:00 
AnswerRe: plz help me about this Algo Pin
Eddy Vluggen2-Jan-09 2:15
professionalEddy Vluggen2-Jan-09 2:15 
QuestionRead From file data till reach ‘\0’ Pin
Ronenb30-Dec-08 20:39
Ronenb30-Dec-08 20:39 
AnswerRe: Read From file data till reach ‘\0’ Pin
Lev Danielyan30-Dec-08 20:44
Lev Danielyan30-Dec-08 20:44 
AnswerRe: Read From file data till reach ‘\0’ [modified] Pin
PIEBALDconsult31-Dec-08 4:43
mvePIEBALDconsult31-Dec-08 4:43 
AnswerRe: Read From file data till reach ‘\0’ Pin
PIEBALDconsult31-Dec-08 6:06
mvePIEBALDconsult31-Dec-08 6:06 
Here's a fairly simple method:

public static string
ReadString
(
    System.IO.Stream Stream
,
    byte             Terminator
)
{
    string result = null ;
    System.Collections.Generic.List<byte> bytes =
        new System.Collections.Generic.List<byte>() ;
    int temp ;

    while ( true )
    {
        temp = Stream.ReadByte() ;

        if ( ( temp == Terminator ) || ( temp == -1 ))
        {
            break ;
        }

        bytes.Add ( (byte) temp ) ;
    }

    if ( bytes.Count > 0 )
    {
        result = System.Text.Encoding.ASCII.GetString ( bytes.ToArray() ) ;
    }
    else
    {
        if ( temp == Terminator )
        {
            result = "" ;
        }
    }

    return ( result ) ;
}


You can convert it to an Extension Method if you like.
GeneralRe: Read From file data till reach ‘\0’ Pin
Ronenb31-Dec-08 19:10
Ronenb31-Dec-08 19:10 
Questionhow to get index in checkboxlist control by passing data value membet Pin
ademsandeepreddy30-Dec-08 20:14
ademsandeepreddy30-Dec-08 20:14 
QuestionLocking Screen! Pin
spiritboy30-Dec-08 19:59
spiritboy30-Dec-08 19:59 
AnswerRe: Locking Screen! Pin
Giorgi Dalakishvili30-Dec-08 20:11
mentorGiorgi Dalakishvili30-Dec-08 20:11 
GeneralRe: Locking Screen! Pin
Michael Bookatz31-Dec-08 1:55
Michael Bookatz31-Dec-08 1:55 
GeneralRe: Locking Screen! Pin
Giorgi Dalakishvili31-Dec-08 4:07
mentorGiorgi Dalakishvili31-Dec-08 4:07 
AnswerRe: Locking Screen! Pin
vaghelabhavesh31-Dec-08 8:16
vaghelabhavesh31-Dec-08 8:16 
Questionhow to write code for browse button Pin
NarVish30-Dec-08 19:54
NarVish30-Dec-08 19:54 
AnswerRe: how to write code for browse button Pin
Giorgi Dalakishvili30-Dec-08 20:12
mentorGiorgi Dalakishvili30-Dec-08 20:12 
AnswerRe: how to write code for browse button Pin
ashok104230-Dec-08 23:37
ashok104230-Dec-08 23:37 
GeneralRe: how to write code for browse button Pin
Not Active31-Dec-08 5:42
mentorNot Active31-Dec-08 5:42 
GeneralRe: how to write code for browse button Pin
ashok104231-Dec-08 23:57
ashok104231-Dec-08 23:57 
QuestionTextbox Event Pin
Nath30-Dec-08 19:46
Nath30-Dec-08 19:46 
AnswerRe: Textbox Event Pin
vaghelabhavesh31-Dec-08 8:20
vaghelabhavesh31-Dec-08 8:20 
QuestionPrint .rdlc Report [modified] Pin
zeeShan anSari30-Dec-08 18:45
zeeShan anSari30-Dec-08 18:45 
Questionzedgraph control Pin
hamidhakimi30-Dec-08 18:37
hamidhakimi30-Dec-08 18:37 
Questionzedgraph control Pin
hamidhakimi30-Dec-08 18:36
hamidhakimi30-Dec-08 18:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.