a3: Grundgerüst
This commit is contained in:
parent
b87fa8a100
commit
0fc98cc661
|
@ -0,0 +1,4 @@
|
|||
# Created by .ignore support plugin (hsz.mobi)
|
||||
.idea
|
||||
bin
|
||||
cmake-build-debug
|
|
@ -0,0 +1,11 @@
|
|||
cmake_minimum_required(VERSION 3.3)
|
||||
project(Hardwarenahe_Programmierung)
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c14")
|
||||
SET(CMAKE_BUILD_TYPE Debug)
|
||||
|
||||
# These are the corresponding output paths
|
||||
set (EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/bin)
|
||||
set (LIBRARY_OUTPUT_PATH ${EXECUTABLE_OUTPUT_PATH})
|
||||
|
||||
add_subdirectory(src/c)
|
|
@ -0,0 +1 @@
|
|||
add_executable(a3 a3.c)
|
|
@ -0,0 +1,30 @@
|
|||
#include "a3.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
void memdump(unsigned char *string) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
int memreplace(char *string, char cin, char cout, char **caddr) {
|
||||
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
if(argc <= 3) {
|
||||
printf("Not enough arguments");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
memdump((unsigned char*)argv[1]);
|
||||
char **lastAddress;
|
||||
int count = memreplace(argv[1], *argv[2], *argv[3], 0);
|
||||
|
||||
printf("Laenge der Zeichenkette (inkl \\0): %i Bytes\n", sizeof(argv[1]));
|
||||
printf("Ersetzen: '%c' mit '%c'\n", *argv[2], *argv[3]);
|
||||
printf("Suchzeichen wurde %i mal gefunden und ersetzt\n", count);
|
||||
printf("zuletzt an Addresse 0x%lx \n", (unsigned long) (&lastAddress));
|
||||
memdump((unsigned char*)argv[1]);
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
void mempdump(unsigned char *string);
|
||||
int memreplace(char *string, char cin, char cout, char **caddr);
|
Loading…
Reference in New Issue