1
0
Fork 0
mirror of https://github.com/hermitcore/libhermit.git synced 2025-03-09 00:00:03 +01:00

extend example to test the I/O interface

This commit is contained in:
Stefan Lankes 2015-10-05 10:10:45 +02:00
parent f74b06d6f7
commit ba755badb5

View file

@ -31,9 +31,12 @@
#include <unistd.h>
#include <errno.h>
#define N 255
int main(int argc, char** argv)
{
int i;
int i, random;
FILE* file;
printf("Hello World!!!\n");
for(i=0; environ[i]; i++)
@ -41,5 +44,15 @@ int main(int argc, char** argv)
for(i=0; i<argc; i++)
printf("argv[%d] = %s\n", i, argv[i]);
file = fopen("/etc/hostname", "r");
if (file)
{
char fname[N] = "";
fscanf(file, "%s", fname);
printf("Hostname: %s\n", fname);
fclose(file);
}
return errno;
}