added file handling again
This commit is contained in:
@@ -22,6 +22,10 @@
|
|||||||
// time
|
// time
|
||||||
#include "stdWullie/time.h"
|
#include "stdWullie/time.h"
|
||||||
|
|
||||||
|
// file handling
|
||||||
|
#include "stdWullie/filehandle/closeOpen.h"
|
||||||
|
#include "stdWullie/filehandle/readWrite.h"
|
||||||
|
|
||||||
|
|
||||||
// string extras
|
// string extras
|
||||||
#include "stdWullie/String/colours.h"
|
#include "stdWullie/String/colours.h"
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
// this code is licenced under Wrathmark licence
|
||||||
|
// © 2026 wullie wulliestudio.com
|
||||||
|
// please see attached licence for full usage and rights
|
||||||
|
|
||||||
|
#ifndef UMODETYPES_H
|
||||||
|
#define UMODETYPES_H
|
||||||
|
|
||||||
|
#ifdef __linux__
|
||||||
|
|
||||||
|
#elif __FreeBSD__
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
// this code is licenced under Wrathmark licence
|
||||||
|
// © 2026 wullie wulliestudio.com
|
||||||
|
// please see attached licence for full usage and rights
|
||||||
|
|
||||||
|
#ifndef CLOSEOPEN_H
|
||||||
|
#define CLOSEOPEN_H
|
||||||
|
long Wopen(const char *pathname, int flags, int mode);
|
||||||
|
long closeFile(int fd);
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
// this code is licenced under Wrathmark licence
|
||||||
|
// © 2026 wullie wulliestudio.com
|
||||||
|
// please see attached licence for full usage and rights
|
||||||
|
|
||||||
|
#ifndef READWRITE_H
|
||||||
|
#define READWRITE_H
|
||||||
|
|
||||||
|
long reader(long fd, char *string, size_t buflen);
|
||||||
|
long writer(long fd, const char *string, size_t buflen);
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -5,6 +5,7 @@
|
|||||||
#include "LocalHeader.h"
|
#include "LocalHeader.h"
|
||||||
#include "stdWullie/definitions/typeNull.h"
|
#include "stdWullie/definitions/typeNull.h"
|
||||||
#include "stdWullie/exit.h"
|
#include "stdWullie/exit.h"
|
||||||
|
#include "stdWullie/filehandle/closeOpen.h"
|
||||||
|
|
||||||
// hanles operations for opening and closeing files
|
// hanles operations for opening and closeing files
|
||||||
|
|
||||||
|
|||||||
@@ -5,11 +5,18 @@
|
|||||||
#include "LocalHeader.h"
|
#include "LocalHeader.h"
|
||||||
#include "stdWullie/definitions/typeNull.h"
|
#include "stdWullie/definitions/typeNull.h"
|
||||||
#include "stdWullie/exit.h"
|
#include "stdWullie/exit.h"
|
||||||
|
#include "stdWullie/filehandle/readWrite.h"
|
||||||
long reader(long fd, char *string, size_t count){
|
long reader(long fd, char *string, size_t buflen){
|
||||||
if(count <= 0){
|
if(buflen <= 0){
|
||||||
safeError("can not parse 0 characters");
|
safeError("can not parse 0 characters");
|
||||||
}
|
}
|
||||||
syscall3(SYS_read, fd, (long)string, (long)count);
|
syscall3(SYS_read, fd, (long)string, (long)buflen);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
long writer(long fd, const char *string, size_t buflen){
|
||||||
|
if(bufflen <=0){
|
||||||
|
safeError("can not write 0 characters to a file");
|
||||||
|
}
|
||||||
|
syscall3(SYS_write, fd, (long)string, (long)buflen);
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user