Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Tweak file reading (but it still needs doing properly)

  • Loading branch information...
commit cab41e51578916b0fa5cef8616c3daaea8699f50 1 parent 2e3fd5b
Edwin Brady authored
Showing with 12 additions and 2 deletions.
  1. +10 −1 evm/stdfuns.c
  2. +2 −1  evm/stdfuns.h
View
11 evm/stdfuns.c
@@ -52,7 +52,16 @@ char* readStr() {
}
// FIXME: Do this properly!
-void* freadStr(void* h) {
+char* freadStr(void* h) {
+ char *buf = NULL;
+ if (buf==NULL) { buf = EMALLOC(sizeof(char)*512); } // yeah, right...
+ fgets(buf,512,(FILE*)h);
+// char *loc = strchr(buf,'\n');
+// if (loc) *(loc+1) = '\0'; else buf[0]='\0';
+ return buf;
+}
+
+void* freadStrAny(void* h) {
static char bufin[128];
bufin[0]='\0';
View
3  evm/stdfuns.h
@@ -32,7 +32,8 @@ int strlt(char* x, char* y);
void* fileOpen(char* name, char* mode);
void fileClose(void* h);
-void* freadStr(void* h);
+char* freadStr(void* h);
+void* freadStrAny(void* h);
void fputStr(void* h, char* str);
int isNull(void* ptr);
Please sign in to comment.
Something went wrong with that request. Please try again.