a3: funktioniert vollständig
This commit is contained in:
parent
eebb2f998c
commit
b9d89c1e85
10
src/c/a3.c
10
src/c/a3.c
|
@ -47,11 +47,6 @@ int main(int argc, char **argv) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t size = 4 * 16;
|
|
||||||
unsigned char *buffer = malloc(size);
|
|
||||||
if(buffer == NULL) return -1;
|
|
||||||
|
|
||||||
|
|
||||||
memdump((unsigned char *) argv[1]);
|
memdump((unsigned char *) argv[1]);
|
||||||
|
|
||||||
|
|
||||||
|
@ -61,11 +56,12 @@ int main(int argc, char **argv) {
|
||||||
unsigned char *copy = malloc(4 * 16 * sizeof(char));
|
unsigned char *copy = malloc(4 * 16 * sizeof(char));
|
||||||
strcpy((char *) copy, argv[1]);
|
strcpy((char *) copy, argv[1]);
|
||||||
|
|
||||||
char *lastAddress = NULL;
|
char test = 't';
|
||||||
|
char *lastAddress = &test;
|
||||||
int count = memreplace((char *) copy, *argv[2], *argv[3], &lastAddress);
|
int count = memreplace((char *) copy, *argv[2], *argv[3], &lastAddress);
|
||||||
printf("Suchzeichen wurde %i mal gefunden und ersetzt\n", count);
|
printf("Suchzeichen wurde %i mal gefunden und ersetzt\n", count);
|
||||||
//TODO: change type
|
//TODO: change type
|
||||||
printf("zuletzt an Addresse %p \n", *lastAddress);
|
printf("zuletzt an Addresse %p \n", lastAddress);
|
||||||
memdump(copy);
|
memdump(copy);
|
||||||
|
|
||||||
free(copy);
|
free(copy);
|
||||||
|
|
Loading…
Reference in New Issue