CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2011
    Posts
    2

    Filestream.Seek + floppy drive

    Hi, what i'm trying to do is to access floppy drive and read some data. To do this i'm using CreateFile p/invoke with filename "\\\\.\\A:" (that's because Filestream.Open doesn't support floppy device reading) and Filestream.Read with handle parameter returned from CreateFile. Everything works perfect except when i try to seek position using Filestream.Seek, it returns with IOException - invalid parameter. I've tried with p/invoke SetFilePointer from win32 but it returns with the same error (ERROR_INVALID_PARAMETER). Funny thing is that the same function works in pure c++ code... Does anyone know why this is happening and how to fix this?

  2. #2
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: Filestream.Seek + floppy drive

    Odd... Then I have not had use for a floppy drive for many years now. I think I would consider reading the entire file into memory and do the seek in memory instead.
    Always use [code][/code] tags when posting code.

  3. #3
    Join Date
    Jul 2011
    Posts
    2

    Re: Filestream.Seek + floppy drive

    Yeah it seems it is the only way to bypass this bug...

  4. #4
    Join Date
    Feb 2011
    Location
    United States
    Posts
    1,016

    Re: Filestream.Seek + floppy drive

    Quote Originally Posted by Marduk View Post
    Yeah it seems it is the only way to bypass this bug...
    Better performance reading it into memory rather than hitting the floppy drive too...
    Best Regards,

    BioPhysEngr
    http://blog.biophysengr.net
    --
    All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.

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

Featured