I tried to initialize my variables with reading them out from a file. However i struggle really hard to make something usefull without writing 50+ lines of Code. Maybe somebody can give me a hint how to deal with this.
my text file ist like: Its guaranteed that after '=' always follows an integer(maybe some whitespace) but never smth else.
a=12
b= 4 c = 14
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
void getAB(int *a, int*){
FILE *file;
file = fopen("file.conf", "r");
// read a and b an their content from file.conf
fclose(file);
return;
}
int main(){
int a,b;
getAB(&a, &b);
printf("A = %i B = %i\n",a, b);
return 0;
}