"ericunfuk" <xu***********@gmail.comwrote:
# Hi, all
#
# I'm very new to C and have a few basic questions:
# I have an image file pic.tif, I want to read this image but only, say,
# 2KB per time and possibily I'm going to store this 2KB in an Array or
# something then I will do something to this 2KB, then I will read
# another 2KB. My question is:
#
# Which function in C allows me to read a file by specifying the amount
# of data to readin each time?
fread and fwrite in stdio.h. You can read or write up to
a specified maximum number of elements, and they return
how many elements were actually read or written. Outside
of stdio.h there may be additional functions like read
and write. You may have to open the file in binary mode.
# How many bytes are occupied by a "char" in C?
A char is a byte; on any system you're likely to use, a
byte is an octet, or 8 bits, so that char, byte, octet,
and eight-bit element are all the same thing. A character
is no longer always exactly a char, sometimes multiple
bytes, but unless you're doing text processing, don't
worry about that.
--
SM Ryan
http://www.rawbw.com/~wyrmwif/
I think that's kinda of personal; I don't think I should answer that.