Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

Commit

Permalink
hello world program (#6)
Browse files Browse the repository at this point in the history
* hello example

* out dir

* README

* Update README.md

* Update hello/README.md

Co-Authored-By: Jakub Konka <kubkon@jakubkonka.com>

* Update task.json

* Add files via upload

* Add files via upload
  • Loading branch information
lukasz-glen authored Jul 9, 2019
1 parent 2d6ce8d commit c2f0f61
Show file tree
Hide file tree
Showing 6 changed files with 5,427 additions and 0 deletions.
26 changes: 26 additions & 0 deletions hello/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
It is simple hello world gWASM program. Download the `hello` directory, enter it, update paths in `task.json` file
```
"input_dir": "/path/to/your/working/directory/hello/in",
"output_dir": "/path/to/your/working/directory/hello/out",
```
and execute the command
```
golemcli tasks create task.json
```

If datadir cannot be found, then
```
golemcli tasks create task.json --datadir=/path/to/your/datadir
```

If golemcli cannot be found, then please read [Golem docs](https://docs.golem.network/#/Products/Brass-Beta/Command-line-interface) on how to use golemcli.

After a while check the output
```
cat out/subtask1/out.txt
```

It should contain
```
hello world!
```
17 changes: 17 additions & 0 deletions hello/hello.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include <stdio.h>

int main(int argc, char** argv) {
char* name = argc >= 2 ? argv[1] : "anonymous";

FILE* f_out = fopen("out.txt", "w");
if (f_out == NULL) {
printf("couldn't open file for writing\n");
return 1;
}

fprintf(f_out, "hello %s!\n", name);

fclose(f_out);

return 0;
}
Loading

0 comments on commit c2f0f61

Please sign in to comment.