Working with File Streams And Memory Streams

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • satish

    #1

    Working with File Streams And Memory Streams

    Hi,
    I have an issue ..i have a text which has the information of 4 test
    files and they are placed in the order
    4 --- this number says (total no of text files)
    File1
    1370 -- Memory of the text file 1
    File2
    1988 -- Memory of text file 2
    SaveToFile -- file3
    644
    Seek -- file 4
    1207
    this the content of the text file 1
    This example requires TListBox, TMemo, TRichEdit, and TButton controls
    placed on the form. The list box should contain one or more items.

    this is the Content of the Text file 2
    --------------------------------------------------
    -----------------------------------
    this is the Content of the Text file 3
    --------------------------------------------------
    -----------------------------------
    this is the Content of the Text file 4
    --------------------------------------------------
    -----------------------------------

    I have wirtten code intially as
    Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
    System.EventArg s) Handles MyBase.Load

    Dim fs As New FileStream("f:\ StreamDemo.yem" , FileMode.Open,
    FileAccess.Read )

    Dim str As StreamReader
    Dim s As String
    Dim i As Integer
    str = New StreamReader(fs )

    'str = New StreamReader("f :\StreamDemo.ye m")
    s = str.ReadLine()

    MessageBox.Show (s)
    Strlist.Add(s)

    For i = 1 To 2 * (Convert.ToInt3 2(s))
    s = str.ReadLine()
    MessageBox.Show (s)
    Strlist.Add(s)
    Next
    str.Close()

    End Sub

    This code will split the Strings of the first eight lines ..by reading
    the no of files

    How to get the content similary by reading the memory can any body
    suggest me how to Start with

    i mean if the file1 size is 10 kb read the 10 kb data and display it
    in rich text and even if we modify the data even that should replicate
    in the main text file along with the Data size

    can any body help me how to move in this issue

    Thanks
    Sati

Working...