I need to get name from the file (string).
But certainly it gets (null) value.
void dealer__init(){
FILE * dealer = fopen(DEALER_L, "r");
fscanf(dealer, "%d %d %255s", &my_og.money, &my_og.check_ok, my_og.name);
printf("%255s\n", my_og.name);
printf("%d\n", my_og.money);
printf("%d\n", my_og.check_ok);
if(money_at_beg == true && my_og.check_ok == 0){
my_og.money = MONEY_AT_BEG_INT;
my_og.check_ok = 1;
dealer__save();
}
printf("My name is set to: %s", &my_og.name);
fclose(dealer);
}
My file:
3000 1 dimitar
My struct:
struct dealer{
int money;
int check_ok;
char *name;
}my_og;