VB.NET School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Page 1 of 1
  • You cannot start a new topic
  • Reply Reply

The process cannot access the file 'D:\pagefile.sys' beca Rate Topic: -----

#1 sonia.sardana  Icon User is offline

  • D.I.C Head
  • PipPip

Reputation: 5
  • View blog
  • Posts: 132
  • Joined: 01-June 08


Dream Kudos: 0

Share |

The process cannot access the file 'D:\pagefile.sys' beca

Posted 17 June 2008 - 09:36 AM

I m Using the Foll. method to Read the Contents of a File. If i m reading the doc,txt prog is working file. I m using the File "D:\pagefile.sys", ERROR is there,The process cannot access the file 'D:\pagefile.sys' because it is being used by another process.
how To Read Contents of "D:\pagefile.sys".
Need UR Help!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!


Imports System.io
Module Module1

    Sub Main()
        Dim fs As FileStream
        fs = New FileStream("D:\Documents and Settings\Administrator\Desktop\SCAN%20HDDDDDDDDDDDDDDDD[1].doc", FileMode.Open, FileAccess.ReadWrite, FileShare.Read)
        Dim d As New StreamReader(fs)

        d.BaseStream.Seek(0, SeekOrigin.Begin)

        While d.Peek() > -1
            Console.WriteLine(d.ReadToEnd)
            Console.ReadLine()
        End While
        d.Close()


    End Sub

End Module



Mod Edit: Please use code tags when posting your code => :code:
Thanks PsychoCoder :)

This post has been edited by PsychoCoder: 17 June 2008 - 09:51 AM

Was This Post Helpful? 0
  • +
  • -


#2 PsychoCoder  Icon User is offline

  • iHater.Init(this);
  • Icon

Reputation: 1364
  • View blog
  • Posts: 19,696
  • Joined: 26-July 07


Dream Kudos: 12925

Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net, jQuery

Re: The process cannot access the file 'D:\pagefile.sys' beca

Posted 17 June 2008 - 09:52 AM

That's a system file, which is always in use. I dont know of a way to read system files like that, I'm not sure how to get around the error you're getting.
Was This Post Helpful? 0
  • +
  • -

#3 modi123_1  Icon User is offline

  • Suiter #2
  • Icon

Reputation: 176
  • View blog
  • Posts: 2,750
  • Joined: 12-June 08


Dream Kudos: 150

Re: The process cannot access the file 'D:\pagefile.sys' beca

Posted 17 June 2008 - 10:27 AM

View PostPsychoCoder, on 17 Jun, 2008 - 12:52 PM, said:

That's a system file, which is always in use. I dont know of a way to read system files like that, I'm not sure how to get around the error you're getting.


I don't believe you can because it's constantly in use.. maybe making a copy and accessing the copy would work..
Was This Post Helpful? 0
  • +
  • -

#4 jacobjordan  Icon User is offline

  • class Me : Perfection
  • Icon

Reputation: 83
  • View blog
  • Posts: 1,495
  • Joined: 11-June 08


Dream Kudos: 1725

Re: The process cannot access the file 'D:\pagefile.sys' beca

Posted 17 June 2008 - 12:34 PM

Not possible in my book. I tried to open it in notepad, didn't work. I tried copying it and opening the copy, didn't work (didn't event let me copy it). No way that i know of.
Was This Post Helpful? 0
  • +
  • -

#5 PsychoCoder  Icon User is offline

  • iHater.Init(this);
  • Icon

Reputation: 1364
  • View blog
  • Posts: 19,696
  • Joined: 26-July 07


Dream Kudos: 12925

Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net, jQuery

Re: The process cannot access the file 'D:\pagefile.sys' beca

Posted 17 June 2008 - 12:37 PM

After further research the other two are correct. Because it's a system file there's no way to stop it from being "in use", and since it's a system file it cannot be copied either. So it appears you're out of luck on this one :)
Was This Post Helpful? 0
  • +
  • -

#6 sonia.sardana  Icon User is offline

  • D.I.C Head
  • PipPip

Reputation: 5
  • View blog
  • Posts: 132
  • Joined: 01-June 08


Dream Kudos: 0

Re: The process cannot access the file 'D:\pagefile.sys' beca

Posted 19 June 2008 - 05:51 AM

Ohh I See. But acc. To me there must be a some way.....May be we are not getting it.
Was This Post Helpful? 0
  • +
  • -

#7 modi123_1  Icon User is offline

  • Suiter #2
  • Icon

Reputation: 176
  • View blog
  • Posts: 2,750
  • Joined: 12-June 08


Dream Kudos: 150

Re: The process cannot access the file 'D:\pagefile.sys' beca

Posted 19 June 2008 - 06:13 AM

View Postsonia.sardana, on 19 Jun, 2008 - 08:51 AM, said:

Ohh I See. But acc. To me there must be a some way.....May be we are not getting it.


Why do you want access to the page file? It's a fairly integral part of Windows to have that page file, and i would imagine to access it from the windows session you are using it on would be prohibited in all sense of the word... not to mention altering the page file is probably a bit on the epic-fail end of the spectrum of things to do to your pc while running it...
Was This Post Helpful? 0
  • +
  • -

#8 narmer93  Icon User is offline

  • D.I.C Regular
  • PipPipPip

Reputation: 9
  • View blog
  • Posts: 315
  • Joined: 13-March 08


Dream Kudos: 0

Re: The process cannot access the file 'D:\pagefile.sys' beca

Posted 19 June 2008 - 01:48 PM

some vb.net projects are weak
it is difficult to describe the word weak
i will give u an example

when i tried the code to end a process,.it worked for some as internet explorer but some times didn't work for yahoo !!!!!!!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1
  • You cannot start a new topic
  • Reply Reply


Fast Reply

  

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users