1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

How to read the data line by line from a File?

Discussion in 'C' started by Shilpa1, Dec 10, 2007.

  1. Shilpa1

    Shilpa1 New Member

    In my application,in Dialog1 writing the data line by line,upto this working perfectly,where as in Dialog2 while reading the data line by line always reading the first line.
    How to read the data line by line?Though simple one,Iam in confusion.Pls help me.

    In Dialog1, for File.txt ,writing the names as


    and on the other side I want to read the names one by one,but In Dialog2 always reading the Name1,not going to the second line.

    In Dialog1

    In Dialog2

  2. Shilpa1

    Shilpa1 New Member

    pls see the File.txt.In Dialog1 Iam encrypting the data and writing the encrypted data to File.In Dialog2, I want to read the encrypted data from File one by one.Is this correct way of writing encrypted data to a File or Is it better to encode the encrypted data?If anybody having the sample code for Encoding/Decoding pls post it.
    Last edited by a moderator: Dec 10, 2007
  3. Salem

    Salem New Member

    1. Use [code][/code] tags when posting code.

    2. Why are you trying to read and write to the file at the same time?
  4. shabbir

    shabbir Administrator Staff Member

    Please try to post instead of giving it as an attachment. I have removed the attachment from the post.
  5. Shilpa1

    Shilpa1 New Member

    In File.txt Iam writing the following encrypted text.Now,I want to read the encrypted data line by line.How to do this?Pls help me.

  6. Salem

    Salem New Member

    Encrypted by whom, using what algorithm and with what key?

    Good algorithms will destroy any sense of the idea of "lines" in the file and present you with a stream of what looks like random bytes.
  7. Shilpa1

    Shilpa1 New Member

    My major problem is how to read the data line by line from a File?Pls gave me an idea.
  8. Salem

    Salem New Member

    Well if it's encrypted you have two choices
    - fgetc, to read the file one byte at a time
    - fread, to read a whole block of bytes at a time.

    Having read some bytes, you then need to decrypt them in order to work out what the real data is, and where the lines are.

Share This Page