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
  1. Home
  2. General Programming
  3. Visual Basic
  4. Corrupt Text Files

Corrupt Text Files

Scheduled Pinned Locked Moved Visual Basic
csharphelpquestionlounge
3 Posts 3 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.
  • B Offline
    B Offline
    Barry Etter
    wrote on last edited by
    #1

    I'm writing a very simple VB .NET application that "monitors" a remote directory (via UNC paths) for a particular data file. The data file is created by a third-party program that creates or appends comma-delimited records to the file. (I think it opens the file, writes the record and then closes the file). My application "wakes up" every few seconds and if this remote file exists, it does the following: 1) Rename the file on the remote directory to minimize possible conflicts. 2) Move the renamed file to the local PC. 3) Process the records in the local file. 4) Delete local file. Pretty simple, I know. But for some reason, I'm getting random "corrupted" records in the file. The only explaination I know is that I'm moving the file while the other application is trying to write to it. The rename-move call is very quick, though. I've tried recreating the problem, but if I'm writing to a file from one process, it won't let me move it. Has anyone else had this problem? If so, how did you solve it? Thanks! Barry Etter

    M D 2 Replies Last reply
    0
    • B Barry Etter

      I'm writing a very simple VB .NET application that "monitors" a remote directory (via UNC paths) for a particular data file. The data file is created by a third-party program that creates or appends comma-delimited records to the file. (I think it opens the file, writes the record and then closes the file). My application "wakes up" every few seconds and if this remote file exists, it does the following: 1) Rename the file on the remote directory to minimize possible conflicts. 2) Move the renamed file to the local PC. 3) Process the records in the local file. 4) Delete local file. Pretty simple, I know. But for some reason, I'm getting random "corrupted" records in the file. The only explaination I know is that I'm moving the file while the other application is trying to write to it. The rename-move call is very quick, though. I've tried recreating the problem, but if I'm writing to a file from one process, it won't let me move it. Has anyone else had this problem? If so, how did you solve it? Thanks! Barry Etter

      M Offline
      M Offline
      Mike Ellison
      wrote on last edited by
      #2

      Is it possible that the third-party program is itself just occasionally writing "corrupted" records in the file? Is it possible it has nothing to do with your app?

      1 Reply Last reply
      0
      • B Barry Etter

        I'm writing a very simple VB .NET application that "monitors" a remote directory (via UNC paths) for a particular data file. The data file is created by a third-party program that creates or appends comma-delimited records to the file. (I think it opens the file, writes the record and then closes the file). My application "wakes up" every few seconds and if this remote file exists, it does the following: 1) Rename the file on the remote directory to minimize possible conflicts. 2) Move the renamed file to the local PC. 3) Process the records in the local file. 4) Delete local file. Pretty simple, I know. But for some reason, I'm getting random "corrupted" records in the file. The only explaination I know is that I'm moving the file while the other application is trying to write to it. The rename-move call is very quick, though. I've tried recreating the problem, but if I'm writing to a file from one process, it won't let me move it. Has anyone else had this problem? If so, how did you solve it? Thanks! Barry Etter

        D Offline
        D Offline
        Dave Kreskowiak
        wrote on last edited by
        #3

        I've seen the same thing. Is this text file that is being written to on a Novell server? I had cases where multiple machines writing to the same file at the same time would produce the problem your describing. There was no way around it because it was a problem in Client32 that wasn't fixed in the last 3 versions I saw. The problem NEVER appeared when I tested the clients in a purely Windows environment, including the server. I ended up rewriting my data collection software that ran on each machine to its information directly to an SQL server instead of writing to a text file. RageInTheMachine9532

        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