Initial commit
This commit is contained in:
58
LIB386/LIB_SYS/LOADSAVE.C
Normal file
58
LIB386/LIB_SYS/LOADSAVE.C
Normal file
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
LOADSAVE (c) Adeline 1993
|
||||
|
||||
Functions:
|
||||
|
||||
- Load
|
||||
- Save
|
||||
*/
|
||||
|
||||
#include <i86.h>
|
||||
#include <dos.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "adeline.h"
|
||||
#include "lib_sys.h"
|
||||
|
||||
|
||||
/*ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ*/
|
||||
ULONG Load( char *name, void *buffer )
|
||||
{
|
||||
LONG handle ;
|
||||
ULONG size ;
|
||||
|
||||
size = FileSize( name ) ;
|
||||
if ( !size ) return(0L) ;
|
||||
|
||||
handle = OpenRead( name ) ;
|
||||
if ( handle )
|
||||
{
|
||||
size = Read( handle, buffer, size ) ;
|
||||
Close( handle ) ;
|
||||
return( size ) ;
|
||||
}
|
||||
return( 0L );
|
||||
}
|
||||
/*ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ*/
|
||||
|
||||
ULONG Save( char *name, void *buffer, ULONG size )
|
||||
{
|
||||
LONG handle ;
|
||||
ULONG nbwrote ;
|
||||
|
||||
handle = OpenWrite( name ) ;
|
||||
if( handle )
|
||||
{
|
||||
nbwrote = Write( handle, buffer, size ) ;
|
||||
Close( handle ) ;
|
||||
if( nbwrote != size ) return FALSE ;
|
||||
return TRUE ;
|
||||
}
|
||||
return FALSE ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user