Skip to content

Commit

Permalink
重新用C寫了一遍,爲了解決依賴dll之類的。
Browse files Browse the repository at this point in the history
  • Loading branch information
RimoChan committed Oct 22, 2019
1 parent 829c03c commit 7ced7ec
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 12 deletions.
46 changes: 34 additions & 12 deletions Librian本體/構建用/虛僞的exe.cpp
Original file line number Diff line number Diff line change
@@ -1,17 +1,39 @@
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <cassert>

char *join(const char *s1, const char *s2) {
char *result = (char *)malloc(strlen(s1) + strlen(s2) + 1);
strcpy(result, s1);
strcat(result, s2);
return result;
}

int main(int argc, char *argv[]) {
string s = string(argv[0]);
string ss = s.substr(s.rfind('\\') + 1, s.rfind('.') - s.rfind('\\') - 1);
char *s = argv[0];
printf("%s\n", s);
char *a = strrchr(s, '\\') + 1, *b = strrchr(s, '.');
b[0] = 0;
printf("<%s>\n", a);
char *name = join(join("_", a), ".kuzu");
printf("[%s]\n", name);

FILE *f = fopen(name, "r");
assert(f != 0);

cout << s << endl;
cout << "<" << ss << ">" << endl;
int length;
char *data;
fseek(f, 0, SEEK_END);
length = ftell(f);
data = (char *)malloc((length + 1) * sizeof (char));
rewind(f);
length = fread(data, 1, length, f);
data[length] = 0;
fclose(f);

ifstream t("_" + ss + ".kuzu");
std::string q((std::istreambuf_iterator<char>(t)),
std::istreambuf_iterator<char>());
printf("%s\n", data);

system(q.c_str());
system(data);
}
Binary file modified Librian本體/構建用/虛僞的exe.exe
Binary file not shown.

0 comments on commit 7ced7ec

Please sign in to comment.