|
|
| Next: file function |
| Author |
Message |
erajaysharma External

Since: Jul 04, 2007 Posts: 6
|
Posted: Wed Jul 04, 2007 6:46 am Post subject: how to read entire 1.44 mb of a floppy Archived from groups: microsoft>public>win2000>file_system (more info?) |
|
|
Hi,
Can any one please tell me how can i read entire 1.44 mb of data from
a floppy starting from sector 0.
Thanks,
Ajay |
|
| Back to top |
|
 |
Olof Lagerkvist External

Since: Jul 04, 2007 Posts: 12
|
Posted: Wed Jul 04, 2007 4:07 pm Post subject: Re: how to read entire 1.44 mb of a floppy [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
erajaysharma.TakeThisOut@gmail.com wrote:
> Hi,
>
> Can any one please tell me how can i read entire 1.44 mb of data from
> a floppy starting from sector 0.
Basically,
HANDLE h = CreateFile("\\\\.\\A:", GENERIC_READ, ..., OPEN_EXISTING, ...);
ReadFile(h, buffer, ...);
--
Olof Lagerkvist
ICQ: 724451
Web: http://here.is/olof |
|
| Back to top |
|
 |
erajaysharma External

Since: Jul 04, 2007 Posts: 6
|
Posted: Wed Jul 04, 2007 10:01 pm Post subject: Re: how to read entire 1.44 mb of a floppy [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
On Jul 4, 7:07 pm, Olof Lagerkvist <s... DeleteThis @no.mail> wrote:
> erajaysha... DeleteThis @gmail.com wrote:
> > Hi,
>
> > Can any one please tell me how can ireadentire1.44mbof data from
> > afloppystarting from sector 0.
>
> Basically,
>
> HANDLE h = CreateFile("\\\\.\\A:", GENERIC_READ, ..., OPEN_EXISTING, ...);
> ReadFile(h, buffer, ...);
>
> --
> Olof Lagerkvist
> ICQ: 724451
> Web:http://here.is/olof
Hi Olof,
I am using following code but it reads only upto 38 K...i want to
write a program which can read entire 1.44 mb, put it into a file and
returns after reading 1.44 mb...
#define SIZE 512
int main()
{
DWORD dwBytesRead;
unsigned char data[SIZE];
HANDLE hFloppy;
hFloppy = CreateFile(
"\\\\.\\A:",
GENERIC_READ,
FILE_SHARE_READ,
NULL,
OPEN_EXISTING,
0,
NULL);
if(hFloppy == INVALID_HANDLE_VALUE)
printf("CreateFile failed\n");
fstream outFile;
outFile.open("image.bin", ios::out | ios::binary);
if(outFile.fail())//check for any problems
{
printf("outFile not opened\n");
return 0;
}
while(1)
{
if(!ReadFile(hFloppy, &data, SIZE,&dwBytesRead, NULL))
{
printf("Read failed.\n");
break;
}
if(!dwBytesRead)
break;
outFile.write(data,SIZE);
}
outFile.close();
}
Thanks,
Ajay |
|
| Back to top |
|
 |
Olof Lagerkvist External

Since: Jul 04, 2007 Posts: 12
|
Posted: Fri Jul 06, 2007 12:15 am Post subject: Re: how to read entire 1.44 mb of a floppy [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
erajaysharma.DeleteThis@gmail.com wrote:
> On Jul 4, 7:07 pm, Olof Lagerkvist <s....DeleteThis@no.mail> wrote:
>
>>erajaysha...@gmail.com wrote:
>>>Can any one please tell me how can ireadentire1.44mbof data from
>>>afloppystarting from sector 0.
>>
>>Basically,
>>
>>HANDLE h = CreateFile("\\\\.\\A:", GENERIC_READ, ..., OPEN_EXISTING, ...);
>>ReadFile(h, buffer, ...);
> I am using following code but it reads only upto 38 K...i want to
> write a program which can read entire 1.44 mb, put it into a file and
> returns after reading 1.44 mb...
<chop>
I can't say I see any obvious problem with that code though I did not
compile and test it. Maybe you could add some debug printouts reporting
the read complete size you get from ReadFile() and also what
GetLastError() returns in case ReadFile() fails (returns FALSE).
--
Olof Lagerkvist
ICQ: 724451
Web: http://here.is/olof |
|
| Back to top |
|
 |
erajaysharma External

Since: Jul 04, 2007 Posts: 6
|
Posted: Fri Jul 06, 2007 4:56 am Post subject: Re: how to read entire 1.44 mb of a floppy [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
On Jul 6, 3:15 am, Olof Lagerkvist <s....RemoveThis@no.mail> wrote:
> erajaysha....RemoveThis@gmail.com wrote:
> > On Jul 4, 7:07 pm, Olof Lagerkvist <s....RemoveThis@no.mail> wrote:
>
> >>erajaysha...@gmail.com wrote:
> >>>Can any one please tell me how can ireadentire1.44mbof data from
> >>>afloppystarting from sector 0.
>
> >>Basically,
>
> >>HANDLE h = CreateFile("\\\\.\\A:", GENERIC_READ, ..., OPEN_EXISTING, ...);
> >>ReadFile(h, buffer, ...);
> > I am using following code but it reads only upto 38 K...i want to
> > write a program which canreadentire1.44mb, put it into a file and
> > returns after reading1.44mb...
>
> <chop>
> I can't say I see any obvious problem with that code though I did not
> compile and test it. Maybe you could add some debug printouts reporting
> thereadcomplete size you get from ReadFile() and also what
> GetLastError() returns in case ReadFile() fails (returns FALSE).
>
> --
> Olof Lagerkvist
> ICQ: 724451
> Web:http://here.is/olof
Thanks Olof,
but i am able to read entire floppy now...i dont know the
reason....floppy it self is a very unreliable medium...
may be thats the reason
Ajay |
|
| Back to top |
|
 |
|
|
|
You can post new topics in this forum You can reply to topics in this forum You can edit your posts in this forum You can delete your posts in this forum You can vote in polls in this forum
|
| |
|
|