This commit is contained in:
Christoph J. Scherr 2023-09-12 18:45:10 +02:00
parent 27afb6247b
commit 15cafc6dae
3 changed files with 12 additions and 5 deletions

View File

@ -9,9 +9,16 @@ int ret19() {
char* structInfo(MyStruct *st) { char* structInfo(MyStruct *st) {
char* buf = malloc(1024*sizeof(char)); char* buf = malloc(1024*sizeof(char));
/* snprintf(buf, sizeof(buf), "foo: %d\n", st->foo); */ sprintf(buf,
/* snprintf(buf, sizeof(buf), "bar: %c", st->bar); */ "Infos about the struct:\n"
sprintf(buf,"Infos about the struct:\nfoo:\t%d\nbar:\t%c\n\ngreetings from C", st->foo, st->bar); "\tfoo:\t%d\n"
"\tbar:\t%c\n"
"\n"
"greetings from C"
,
st->foo,
st->bar
);
return buf; return buf;
} }

View File

@ -1,4 +1,3 @@
///
/// we could simply do this to compile the test lib to a static lib, /// we could simply do this to compile the test lib to a static lib,
/// but that solution might not scale as good as calling a professional /// but that solution might not scale as good as calling a professional
/// build system /// build system

View File

@ -1,6 +1,7 @@
fn main() { fn main() {
println!( println!(
"This is the default executable! It does not do much, use another executable. "SUCCESS!!!
This is the default executable! It does not do much, use another executable.
Select your target like this: Select your target like this:
`cargo run --bin $TARGET` `cargo run --bin $TARGET`