🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #11201

Re: CreateFile and ReadFile

#11201
From: ray
Date: Thu, 19 Feb 2004 18:09
30 lines
1917 bytes
but i can use C# to do it
//===============================
FileStream fs = new
FileStream("\\\\.\\PhysicalDrive0",System.IO.FileMode.Open );
   for(int i = 0;i < 100 ;i++)
   {
    Byte[] b = new Byte[1];
    int byteCount = 0;
    byteCount = fs.Read(b,0, 1);
}

CBuilder has such function or not?

"Andrue Cope" <no.spam@spammy.com> ???
news:ih67f05a4bzf.1w8m6acs1eu0e.dlg@40tude.net ???...
> On Fri, 20 Feb 2004 00:42:58 +0800, ray wrote:
>
> > Hi,
> > i can use the following code to read a drive, but it just allows me to
read
> > 512*n bytes (sector size) every time.
> > how can i read 1 byte every time?
>
> You can't. Block devices are called block devices because they can only be
> read block by block. A block for most hard drives will be 512 sectors.
> Standard practice is to read the entire block then extract the bytes that
> you really need.
> -- 
> Andrue Cope
> [Bicester UK]
Technical Details
Message-ID: <4034fbe4$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <4034e792$1@newsgroups.borland.com> <ih67f05a4bzf.1w8m6acs1eu0e.dlg@40tude.net>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,a2e178d9fedcf99e
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2004-02-19 10:11:09 PST
Reply-To: "ray" <srayray@hotmail.com>
From: "ray" <srayray@hotmail.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <4034e792$1@newsgroups.borland.com> <ih67f05a4bzf.1w8m6acs1eu0e.dlg@40tude.net>
Subject: Re: CreateFile and ReadFile
Date: Fri, 20 Feb 2004 02:09:41 +0800
Lines: 32
Organization: ray
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 203.176.224.204
Message-ID: <4034fbe4$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1077214180 203.176.224.204 (19 Feb 2004 10:09:40 -0800)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail