Results 1 to 4 of 4

Thread: hello friends....how to find the frequency of chars in a text file

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2003
    Location
    india
    Posts
    2

    Question hello friends....how to find the frequency of chars in a text file

    hello friends.... i need help

    how to count the frequency of char in a text file....
    can anyone tell me or send me the code in vb.net


    example
    suppose in a file

    aaaabbbbccccdddeeee

    then i we should get the output like
    not only alphabet.. but also special characters

    a = 4 ,b = 4,c = 4 ,d = 3 e = 4
    goutham

  2. #2
    Lively Member
    Join Date
    Jul 2003
    Location
    Kuala Lumpur (Malaysia)
    Posts
    92

    Smile

    Hi,

    It is easy.... assume that you are calculate the character are from ascii 1 to ascii 255.

    Declare one integer array of 255 slots:

    then read byte by byte, convert to ascii code and put it into the ascii code slot. Ex:

    freq(asc(myChar)) +=1

    Loop all then way until finish and then check the result.

  3. #3

    Thread Starter
    New Member
    Join Date
    Sep 2003
    Location
    india
    Posts
    2

    Question hi guys... thanks for the replying... i have new doubt

    hello friends... may be my doubts seems to be stupid... but i really want to know...


    1. how to find the system names/ip that r online in LAN
    2. how do i get the list of shared drives on lan and access them.

    can anyone help me out by sending code for it in vb.net or please give me detailed algorithm.



    thanking you,

    goutham
    goutham

  4. #4
    Lively Member
    Join Date
    Jul 2003
    Location
    Kuala Lumpur (Malaysia)
    Posts
    92
    Imports system
    Imports System.Net.DNS

    Private Function GetIPAddress() As String
    Dim oAddr As System.Net.IPAddress
    Dim sAddr As String
    With system.Net.DNS.GetHostByName(system.Net.DNS.GetHostName())
    oAddr = New System.Net.IPAddress(.AddressList(0).Address)
    sAddr = oAddr.ToString
    End With
    GetIPAddress = sAddr
    End Function

    Private Function GetName() as string
    Dim shostname As String
    shostname = system.Net.DNS.GetHostName
    return shostname
    End Function

    to list the shared folder, just Dir("\\" & myHostTarget ) and filter with folder attribute.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width