Saving strings with Dini
#1

I know Dini is outdated blah blah blah but I'm just practicing with it and I'm having some trouble saving a string with it.

It looks a little something like this:

Код:
enum FactionInformation
{
FactionName[24]
};

new factions[5][FactionInformation];

public SaveFactions
{
      	    dini_Set(file, "Faction 1 Name:", FactionInfo[1][FactionName]);
}

public LoadFactions
{
 blahahahaha
{
	    FactionInfo[1][FactionName] = dini_Get(file, "Faction 1 Name:");
}
Basically, I'm trying to save the faction name as a string but I get the error "Array sizes do not match" on every single one that is supposed to be a string, like that.
Reply
#2

With dini (not sure but) you need to select the file you want to save into first. Also make
pawn Код:
public LoadFactions
into:
pawn Код:
public LoadFactions()
Reply
#3

Quote:
Originally Posted by futuretrucker
Посмотреть сообщение
With dini (not sure but) you need to select the file you want to save into first. Also make
pawn Код:
public LoadFactions
into:
pawn Код:
public LoadFactions()
I know that obviously.. I said this is just what it looks like I didn't copy my work.
Reply
#4

Change the size of the [24] string to something higher (128, 256...). I'm pretty sure it'll work.

I know it is a waste of memory, but sometimes old methods like this need HUGE strings for nothing.
Before, I used strtok, and I needed always a 256 size tmp. If I put anything lower, bam, that error appears.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)