Click here to Skip to main content
16,005,467 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: how to display a gif by cximage Pin
vikas amin24-Nov-05 0:17
vikas amin24-Nov-05 0:17 
AnswerRe: how to display a gif by cximage Pin
ThatsAlok29-Nov-05 18:22
ThatsAlok29-Nov-05 18:22 
QuestionHow to do event driven in MFC Pin
LaHaHa23-Nov-05 18:19
LaHaHa23-Nov-05 18:19 
AnswerRe: How to do event driven in MFC Pin
Cool Ju23-Nov-05 20:05
Cool Ju23-Nov-05 20:05 
GeneralRe: How to do event driven in MFC Pin
LaHaHa23-Nov-05 22:35
LaHaHa23-Nov-05 22:35 
GeneralRe: How to do event driven in MFC Pin
Loc Milkyway24-Nov-05 6:03
Loc Milkyway24-Nov-05 6:03 
QuestionStill in problem... Pin
Aqueel23-Nov-05 17:53
Aqueel23-Nov-05 17:53 
AnswerRe: Still in problem... Pin
kakan23-Nov-05 19:46
professionalkakan23-Nov-05 19:46 
Good morning.

The argument to SetFilePointer() HAS to be an even multiple of the sector size. In your case (a diskette), the sector size is 512.
In fact, ALL operations on a disc device is done on one (or more) complete sector(s) at the time. This goes for seek, read and write.

So:
First, set the file pointer to an even mutiple of 512, in this case it will be 1024.
Then, read a complete (or more) sector(s). A sector is the smallest bit of information a disk device can handle.

Try this:

<br />
HANDLE fp;<br />
short int data = 0;<br />
DWORD count;<br />
unsigned char buffer[512];<br />
fp = CreateFile ("\\\\.\\a:",GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_ALWAYS,0,NULL);<br />
SetFilePointer(fp,1024,NULL,FILE_BEGIN);<br />
ReadFile(fp,buffer,512, &count, NULL); // Read the sector, 512 bytes<br />
data = *(buffer + 56);<br />
cout <<data; <br />


Kakan

-- modified at 1:57 Thursday 24th November, 2005
GeneralRe: Still in problem... Pin
Aqueel25-Nov-05 3:00
Aqueel25-Nov-05 3:00 
GeneralRe: Still in problem... Pin
kakan27-Nov-05 19:06
professionalkakan27-Nov-05 19:06 
QuestionDisplaying image on full screen Pin
Vancouver23-Nov-05 16:49
Vancouver23-Nov-05 16:49 
AnswerRe: Displaying image on full screen Pin
ThatsAlok29-Nov-05 17:59
ThatsAlok29-Nov-05 17:59 
GeneralRe: Displaying image on full screen Pin
Vancouver29-Nov-05 20:15
Vancouver29-Nov-05 20:15 
Questionvisual basic and access Pin
RiNaZaiNoN23-Nov-05 15:24
RiNaZaiNoN23-Nov-05 15:24 
QuestionSort Array of Objects Pin
kenexcelon23-Nov-05 14:23
kenexcelon23-Nov-05 14:23 
AnswerRe: Sort Array of Objects Pin
Christian Graus23-Nov-05 14:37
protectorChristian Graus23-Nov-05 14:37 
QuestionEdit Control flashes Pin
LeeeNN23-Nov-05 13:51
LeeeNN23-Nov-05 13:51 
QuestionEmbedded browser control leaks handles? Pin
dandy7223-Nov-05 11:25
dandy7223-Nov-05 11:25 
Questionfile searching problem Pin
Binary011023-Nov-05 8:40
Binary011023-Nov-05 8:40 
AnswerRe: file searching problem Pin
Curtis Schlak.23-Nov-05 9:57
Curtis Schlak.23-Nov-05 9:57 
QuestionDefining a target architecture Pin
Demian Panello23-Nov-05 8:20
Demian Panello23-Nov-05 8:20 
QuestionRegistration or Login Screen in an SDI application Pin
sdancer7523-Nov-05 7:22
sdancer7523-Nov-05 7:22 
AnswerRe: Registration or Login Screen in an SDI application Pin
Marc Soleda23-Nov-05 20:47
Marc Soleda23-Nov-05 20:47 
AnswerRe: Registration or Login Screen in an SDI application Pin
Cool Ju24-Nov-05 0:37
Cool Ju24-Nov-05 0:37 
QuestionMFC and Global Variables :How can i access them ? Pin
sdancer7523-Nov-05 7:19
sdancer7523-Nov-05 7:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.