|
|
DataMuseum.dkPresents historical artifacts from the history of: Commodore CBM-900 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Commodore CBM-900 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - download
Length: 865 (0x361)
Types: TextFile
Notes: UNIX file
Names: »read.c«
└─⟦f27320a65⟧ Bits:30001972 Commodore 900 hard disk image with partial source code
└─⟦2d53db1df⟧ UNIX Filesystem
└─⟦this⟧ »frankh/src/junk/read.c«
char bf[512];
main()
{
long blk;
register int i, j, fdi, fdo;
extern char pat[512];
printf(" Begin\n");
for (i = 0; i < 512; ++i)
bf[i] = 1 ;
printf(" here \n" );
for (i = 0; i < 512 ; ++i)
{
j = bf[i];
printf(" %u",j);
}
if((fdi = open("/dev/hd10", 0)) < 0)
{
printf("Open failed\n");
exit(1);
}
if((fdo = open("/dev/hd10", 1)) < 0)
{
printf("Open failed\n");
exit(1);
}
lseek(fdi, 512L, 0);
printf("\n\n seek ok\n");
if (read(fdi, &bf[0], 512) != 512)
printf(" Bad read \n");
for (i = 0; i < 512 ; ++i)
{
j = bf[i];
printf(" %u", j);
}
for (i = 0; i < 512; ++i)
bf[i] = 1;
lseek(fdo, 1024L, 0);
if (write(fdo, bf, 512) != 512)
printf( " Bad write \n");
lseek(fdi, 1024L, 0);
if (read(fdi, bf, 512) != 512)
printf(" Bad read \n");
for (i = 0; i < 512; ++i)
printf(" %u",bf[i]);
close(fdi);
close(fdo);
}