Mail Archives: djgpp/1997/09/30/20:29:38
Message-Id: | <9710010022.AA04532@free.polbox.pl>
|
From: | "=?ISO-8859-2?Q?Robert_Darmochwa=B3?=" <kacmajor AT polbox DOT com>
|
To: | "DJGPP Mailing List" <djgpp AT delorie DOT com>
|
Subject: | how to get filesize,and similiar problems.
|
Date: | Tue, 30 Sep 1997 22:18:13 +0100
|
Mime-Version: | 1.0
|
This is a multi-part message in MIME format.
------=_NextPart_000_01BCCDEE.BE3CD6E0
Content-Type: multipart/alternative; boundary="----=_NextPart_001_01BCCDEE.BE3CD6E0"
Content-Transfer-Encoding: 7bit
------=_NextPart_001_01BCCDEE.BE3CD6E0
Content-Type: text/plain; charset=ISO-8859-2
Content-Transfer-Encoding: 7bit
hi!
here is how i handle fileio:
instead of opening ,handles etc. i have simple ' file *loadfile()
'function.
maybe my two lame source code files will be helpfull.
man2die4 AT earthling DOT net
------=_NextPart_001_01BCCDEE.BE3CD6E0
Content-Type: text/html; charset=ISO-8859-2
Content-Transfer-Encoding: quoted-printable
<html><head></head><BODY bgcolor=3D"#FFFFFF"><p><font size=3D2 =
color=3D"#000000" face=3D"Arial">hi!<br>here is how i handle =
fileio:<br>instead of opening ,handles etc. i have simple ' file =
*loadfile() 'function.<br>maybe my two lame source code files will be =
helpfull.<br><br>man2die4 AT earthling DOT net<br><br><br></p>
</font></body></html>
------=_NextPart_001_01BCCDEE.BE3CD6E0--
------=_NextPart_000_01BCCDEE.BE3CD6E0
Content-Type: application/octet-stream; name="Fileio.c"
Content-Transfer-Encoding: 7bit
Content-Description: Fileio.c (C Plik)
Content-Disposition: attachment; filename="Fileio.c"
#include <dos.h>
#include <fileio.h>
#include <sys/stat.h>
unsigned int FileSize(char *name)
{struct stat s;
stat(name,&s);
return(s.st_size);
};
void *LoadFile(char *name)
{int h;
unsigned int size;
void *pntr;
int opresult;
_dos_open(name,2,&h);
size=FileSize(name);
pntr=(void *) calloc(1,size);
_dos_read(h,pntr,size,&opresult);
_dos_close(h);
return pntr;
}
void WriteFile(char *name,void *dat,int count)
{
}
void *IniPtr;
void AssignIniFile(char *fn)
{
if (IniPtr) free(IniPtr);
IniPtr=LoadFile(fn);
}
char *IniString;
------=_NextPart_000_01BCCDEE.BE3CD6E0
Content-Type: application/octet-stream; name="Fileio.h"
Content-Transfer-Encoding: 7bit
Content-Description: Fileio.h (H Plik)
Content-Disposition: attachment; filename="Fileio.h"
extern void *LoadFile(char *name);
extern unsigned int FileSize(char *name);
------=_NextPart_000_01BCCDEE.BE3CD6E0--
-- [ REKLAMA / ADVERTISEMENT ] ------------------------
WPADNIJ, ZEBY NIE WPASC!
http://www.ako2.com.pl
-------------------------------------------------------
- Raw text -