Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. how to bring pointer to the beginning of file(streamreader)

how to bring pointer to the beginning of file(streamreader)

Scheduled Pinned Locked Moved C#
helptutorial
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    ashu_sharma21
    wrote on last edited by
    #1

    Hi, I am using StreamReader to read a file. I have to 2 tasks in a function;1st if of reading total lines in the file and 2nd is to do manipulation with the contents of the file. Now when i read the total lines in the file .. the pointer reaches to the end of file and then when i call second function for manipulation with the contents, it says no line to read. Is there any method of StreamReader which i could use before calling my second funtion so that i could start reading file from start. Please help! Ashu Sharma Web Analyst

    M 1 Reply Last reply
    0
    • A ashu_sharma21

      Hi, I am using StreamReader to read a file. I have to 2 tasks in a function;1st if of reading total lines in the file and 2nd is to do manipulation with the contents of the file. Now when i read the total lines in the file .. the pointer reaches to the end of file and then when i call second function for manipulation with the contents, it says no line to read. Is there any method of StreamReader which i could use before calling my second funtion so that i could start reading file from start. Please help! Ashu Sharma Web Analyst

      M Offline
      M Offline
      mav northwind
      wrote on last edited by
      #2

      Hi! Just set the underlying Stream's Position property to 0. mav

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups