Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Read and write one bit

0 views
Skip to first unread message

Mark

unread,
Sep 27, 2000, 3:00:00 AM9/27/00
to
How can I read and write one bit at a time from and to a file?


rteller

unread,
Sep 27, 2000, 3:00:00 AM9/27/00
to
Mark

Read the file buffer by buffer
AssignFile/Reset/BlockRead
then ...
go along the buffer byte by byte
AByte := Buffer[x]
then...
when you have each byte look at each bit
if (AByte and (1 shl y)) = 0 then AByte := 0 else AByte := 1

Do you need more code?

Richard Teller
rte...@doctors.org.uk

"Mark" <ma...@producingfaith.org> wrote in message
news:st4kc4j...@corp.supernews.com...

Mark

unread,
Sep 27, 2000, 3:00:00 AM9/27/00
to
> when you have each byte look at each bit
> if (AByte and (1 shl y)) = 0 then AByte := 0 else AByte := 1

What is the "1 shl y"?

Can this be done with TFileStream or FileRead as well?

Thanks

0 new messages