Mercurial > repo
view share/delvs-master/main.c @ 5983:e9e46956a506
<oerjan> mk wisdom/welcome.sv//Hej och v\xc3\xa4lkommen till den internationella knutpunkten f\xc3\xb6r esoterisk programmeringsspr\xc3\xa5ksdesign och -drifts\xc3\xa4ttning! F\xc3\xb6r mer information, se v\xc3\xa5r wiki: <http://esolangs.org/>. (F\xc3\xb6r den andra sortens esoterism, pr\xc3\xb6va #esoteric p\xc3\xa5 EFnet eller DALnet.)
author | HackBot |
---|---|
date | Mon, 14 Sep 2015 17:49:06 +0000 |
parents | 38a5b4d8a98e |
children |
line wrap: on
line source
#include <stdio.h> #include <string.h> #include <stdlib.h> #include "delvs.h" int main(int argc, char *argv[]) { if(argc > 1) { FILE *fp; long size; fp = fopen(argv[1], "r"); if(fp == NULL) { printf("File: \"%s\" not found\n", argv[1]); return 1; } fseek(fp, 0, SEEK_END); size = ftell(fp); rewind(fp); char *temp = (char*) malloc (100); char *file = (char*) malloc (size); file[0] = '\0'; while (fgets(temp, 100, fp) != NULL) strcat(file, temp); free(temp); fclose(fp); struct Data g; g.code = file; g.bit = 7; g.pointer = &g.vars[15000]; lexer(&g); } else { printf("Usage: %s <filename>\n", argv[0]); } return 0; }