简介
函数名: randbrd
功 能: 随机块读
用 法: int randbrd(struct fcb *fcbptr, int reccnt);
程序例
#include
#include
#include
#include
int main(void)
{
char far *save_dta;
char line[80], buffer[256];
struct fcb blk;
int i, result;
/* get user input file name for dta */
gets(line);
/* put file name in fcb */
if (!
parsfnm(line, &blk, 1))
{
exit(1);
}
/* open file with DOS FCB open file */
/* save old dta, and set new one */
/* set up info for the new dta */
blk.fcb_recsize = 128;
blk.fcb_random = 0L;
result = randbrd(&blk, 1);
/* check results from randbrd */
if (!result)
else
{
exit(1);
}
/* read in data from the new dta */
for (i=0; i<128; i++)
putchar(buffer);
/* restore previous dta */
setdta(save_dta);
return 0;
}