/ Published in: C++

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
#include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { char *buffer1 = (char *)calloc(5, sizeof(char)); char *buffer2 = (char *)calloc(15, sizeof(char)); char *tmp; strcpy(buffer2, "ls -a --color"); strcpy(buffer1, argv[1]); // Indirizzi di memoria... printf("%p <-- buffer1\n", buffer1); printf("%p <-- buffer2\n", buffer2); printf("\n\n"); // Stampa indirizzi... printf("Start code....\n"); tmp=buffer1; while(tmp<buffer2+15) { printf("%p: %c (0x%x)\n", tmp, *tmp, *(unsigned int *)tmp); tmp++; } printf("\n"); system(buffer2); return 0; }
Comments
