reading files with strings in them?
#1

how can i read a dini file with a sting in it?

Like
Код:
new File:example = fopen("%s.txt", io_read);
%s is there name

This dnt work:

Код:
new str[128], f[256], n[24];
GetPlayerName(playerid,n,24);
new File:example = fopen(f,sizeof(f),"%s.txt",n,io_read);
Any help :S
Reply
#2

pawn Код:
#define USERBASE "Users/%s.txt"
new DBstr[128]
GetPlayerName(playerid, playername, sizeof(playername));
format(DBstr,sizeof(DBstr),USERBASE,udb_encode(playername));
is how i do it with dini
then just...whatever
pawn Код:
dini_Create(DBstr);
dini_IntSet(DBstr, "Password",      udb_hash(tmp));
dini_FloatSet(DBstr, "TimeOnline",          0.0);
dini_IntSet(DBstr, "Bank    ",          30000);
Reply
#3

dude....i wana know how to open files with strings.....not format them/....
Reply
#4

that is how you do it if there is something unique in the name then you must format it first so it reads how you want it to
like
pawn Код:
new DBstr[128]
GetPlayerName(playerid, playername, sizeof(playername));
format(DBstr,sizeof(DBstr),%s.txt,playername);
dini_Create(DBstr);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)