13 fprintf(stderr,
"Usage: nrnbinstr \"pattern\" \"binaryfile\"\n");
16 const char* pat = argv[1];
17 const char*
fname = argv[2];
19 FILE* f =
fopen(fname,
"rb");
21 fprintf(stderr,
"Could not open %s\n", fname);
25 char*
buf =
new char[10000];
26 int size = fread(buf,
sizeof(
char), 10000, f);
30 char*
result =
new char[10000];
31 int lenpat = strlen(pat);
32 int ifirst=0, ipat=0, iresult=0;
34 for (
int i=0;
i < size-1; ++
i) {
36 if (c == 0 && buf[
i+1] != 0) {
continue; }
38 if (c ==
':' && iresult > 0) {
41 result[iresult++] =
c;
45 result[iresult] =
'\0';
46 printf(
"%s\n", result + icolon);
static const char * fname(const char *name)
fprintf(stderr, "Don't know the location of params at %p\, pp)
int main(int argc, const char **argv)