home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
573b.lha
/
AMAX_Ram_v1.1
/
RamRead.c
< prev
next >
Wrap
C/C++ Source or Header
|
1991-04-23
|
965b
|
48 lines
/* RamRead.c (c) 1991 Clint Hastings */
#include <exec/types.h>
#include <exec/memory.h>
#include <dos.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <proto/all.h>
BPTR fh;
char *amaxbuf;
main( argc, argv )
int argc;
char *argv[];
{
long amaxbuflen=0x500000, start=0x500000, xferbytes;
char **ptr=NULL;
int base=0;
if(argc != 4) {
printf("Usage: %s startaddr length filename\n", argv[0]);
exit(10);
}
amaxbuf = (char *) start;
start=strtol(argv[1], ptr, base);
ptr = NULL;
amaxbuflen=strtol(argv[2], ptr, base);
printf("\nRAM Read v1.0\n");
printf( "~~~~~~~~~~~~~~\n");
/* Try to open the file */
fh = Open(argv[3], MODE_OLDFILE);
if (fh) { /* file open */
printf("File open, reading...");
xferbytes = Read( fh, amaxbuf, amaxbuflen);
printf("\nFile %s read, ", argv[3]);
printf("%ld bytes.\n\n", xferbytes);
Close(fh);
} else {
printf("\nCouldn't open file %s! Aborting.\n\n", argv[3]);
}
}