New line in a file (with dini)
#7

Do not use dini for this, instead use the normal SA:MP natives (fopen, fread, ...)

pawn Код:
static dialogText[256]; //Change size if needed
new File:DFile = fopen("Dialogs/Dialog1.txt", io_read), _tmpstr[64];
dialogText[0] = 0x0;
if(DFile)
{
    while(fread(DFile, _tmpstr)) //Reads the file line-by-line
    {
        strcat(dialogText, _tmpstr); //Adds the line to the end of the dialogText string
    }
}
ShowPlayerDialog(playerid, 2, 0, "Title:", dialogText, "Ok", "Back");
-------------------------

Quote:
Originally Posted by iRage
Посмотреть сообщение
For some reason the \n and \r don't work if you save them to a file using the script then getting them back.
Have you tried putting the text in File.ini using notepad?
That's because \r and \n are some type of "special characters", when you use them in PAWN it gets converted to 0xD (\r) and 0xA (\n) but if you type it in a file it will stay "as is" (Just a simple \ and a "r" or "n"). If you use notepad++ with "Show all characters" enabled it will show a "CR" and "LF" at the end of each line, that's \r\n
Reply


Messages In This Thread
New line in a file (with dini) - by Dehumanizer - 15.05.2012, 00:36
Re: New line in a file (with dini) - by SuperViper - 15.05.2012, 00:42
Re: New line in a file (with dini) - by Dehumanizer - 15.05.2012, 00:49
Re: New line in a file (with dini) - by iRage - 15.05.2012, 00:53
Re: New line in a file (with dini) - by Dehumanizer - 15.05.2012, 01:00
Re: New line in a file (with dini) - by iRage - 15.05.2012, 01:32
Respuesta: New line in a file (with dini) - by OPremium - 15.05.2012, 01:37
Re: Respuesta: New line in a file (with dini) - by iRage - 15.05.2012, 01:43
Re: New line in a file (with dini) - by john_jenkins - 15.05.2012, 05:26
Re: New line in a file (with dini) - by TzAkS. - 15.05.2012, 05:27

Forum Jump:


Users browsing this thread: 3 Guest(s)