Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7541745
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T07:58:27+00:00 2026-05-30T07:58:27+00:00

I have this bit of code: second = strtok (NULL,\n); logprintf(second); if(_stricmp(second,WINDOWS) == 0)

  • 0

I have this bit of code:

                        second = strtok (NULL,"\n");
                        logprintf(second);
                        if(_stricmp(second,"WINDOWS") == 0)

The logprintf prints data into a logfile, and it prints “WINDOWS” (without quotes).

but _stricmp returns 13 somehow.. So the if check never gets passed. I’ve tried doing sscanf/sprintf/other string ways but none work. I’m out of ideas.

The full code:

#ifdef WIN32


char buf[65535];
bool found = false;
bool install = false;
bool installing = false;
unsigned int installed = 0;


WIN32_FIND_DATA fd;
HANDLE h = FindFirstFile(L"./*.AIFPAK", &fd);

char * NAME = NULL;
char * ID = NULL;
char * AUTHOR = NULL;
int VERSION;

HZIP hz = OpenZip(fd.cFileName,0);

ZIPENTRY ze; 
GetZipItem(hz,-1,&ze); 
int numitems=ze.index;
for (int i=0; i<numitems; ++i)
{ 
    GetZipItem(hz,i,&ze);

    if(found == false)
    {
        if(_wcsicmp(ze.name,L"INSTALL.AIFLIST") == 0)
        {
            found = true;
            UnzipItem(hz,i,buf,65535);
            i = 0;
            stringstream strx;
            strx << buf;
            string line;     
            while (getline(strx, line)) { 
                char * first = NULL;
                char * second = NULL;
                char * third = NULL;
                first = strtok ((char *)line.c_str()," ");
                if(install == false)
                {
                    if(_stricmp(first,"NAME") == 0)
                    {
                        NAME = strtok (NULL,"\n");
                    }
                    if(_stricmp(first,"ID") == 0)
                    {
                        ID = strtok (NULL,"\n");
                    }
                    if(_stricmp(first,"AUTHOR") == 0)
                    {
                        AUTHOR = strtok (NULL,"\n");
                    }
                    if(_stricmp(first,"VERSION") == 0)
                    {
                        VERSION = atoi(strtok (NULL,"\n"));
                    }
                    if(_stricmp(first,"START_INSTALL") == 0)
                    {
                        second = strtok (NULL,"\n");
                        logprintf(second);
                        if(_stricmp(second,"WINDOWS") == 0)
                        {
                            cout << "INSTALLAH\n";
                            install = true;
                            cout << NAME << "|" << ID << "|" << AUTHOR << "|" << VERSION << "|\n";
                        }
                    }
                }
                else
                {
                    cout << "ELSE FIRST: " << first << "\n";
                    if(_stricmp(first,"UNPACK") == 0)
                    {
                        second = strtok (NULL,">");
                        third = strtok (NULL,"\n");
                        cout << first << "|" << second << "|" << third << "|\n";
                        ToDoVec.push_back(ToDoInfo(0,second,third));
                    }
                    if(_stricmp(first,"PRINT") == 0)
                    {
                        second = strtok (NULL,"\n");
                        cout << first << "|" << second << "|" << third << "|\n";
                        ToDoVec.push_back(ToDoInfo(3,second,""));
                    }
                    if(_stricmp(first,"ADD_PLUGIN") == 0)
                    {
                        second = strtok (NULL,"\n");
                        cout << first << "|" << second << "|" << third << "|\n";
                        ToDoVec.push_back(ToDoInfo(1,second,""));
                    }
                    if(_stricmp(first,"ADD_FILTERSCRIPT") == 0)
                    {
                        second = strtok (NULL,"\n");
                        cout << first << "|" << second << "|" << third << "|\n";
                        ToDoVec.push_back(ToDoInfo(2,second,""));
                    }
                    if(_stricmp(first,"END_INSTALL") == 0)
                    {
                        break;
                    }
                }
            } 
        }
    }
    else
    {
        if(installing == false)
        {
            i = 0;
            installing = true;
            for(unsigned int ix = 0; ix < ToDoVec.size(); ++ix)
            {
                cout << "|" << ToDoVec.at(ix).action << "|" << ToDoVec.at(ix).string1 << "|" << ToDoVec.at(ix).string2 << "|\n";
            }
        }
        else
        {

        }
    }
}
found = false;
install = false;
installing = false
CloseZip(hz);

while (FindNextFile(h, &fd))
{
//fnVec.push_back(fd.cFileName);
}
#else//assuming linux

#endif

The “INSTALL.AIFLIST” file looks like this:

NAME Route Connector Plugin
ID GAMER_GPS
VERSION 1733
AUTHOR Gamer_Z

START_INSTALL WINDOWS

UNPACK RouteConnector/plugins/RouteConnectorPlugin.dll>./plugins/RouteConnectorPlugin.dll
UNPACK RouteConnector/examples/other/filterscripts/Node_GPS.amx>./filterscripts/Node_GPS.amx
UNPACK RouteConnector/examples/other/filterscripts/Node_GPS.pwn>./filterscripts/Node_GPS.pwn
UNPACK RouteConnector/scriptfiles/GPS.dat>./scriptfiles/GPS.dat
UNPACK RouteConnector/sampGDK/EXTRACTED/libsampgdk-2.2.1-win32/bin/sampgdk2.dll>./sampgdk2.dll

ADD_PLUGIN RouteConnectorPlugin
ADD_FILTERSCRIPT Node_GPS

END_INSTALL

START_INSTALL LINUX

UNPACK RouteConnector/plugins/RouteConnectorPlugin.so>./plugins/RouteConnectorPlugin.so
UNPACK RouteConnector/examples/other/filterscripts/Node_GPS.amx>./filterscripts/Node_GPS.amx
UNPACK RouteConnector/examples/other/filterscripts/Node_GPS.pwn>./filterscripts/Node_GPS.pwn
UNPACK RouteConnector/scriptfiles/GPS.dat>./scriptfiles/GPS.dat
PRINT To make this plugin work you must install the sampgdk library from www.github.com/Zeex/ (if you don't have it installed)

ADD_PLUGIN RouteConnectorPlugin.so
ADD_FILTERSCRIPT Node_GPS

END_INSTALL

All the data is read correctly into ‘buf’.

Can anybody suggest how to fix that problem?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T07:58:28+00:00Added an answer on May 30, 2026 at 7:58 am

    It looks as if you’re not accounting for CRLF line endings. Opening a file in text mode will translate “\r\n” to “\n”, but there’s nothing in your code that does so. If “WINDOWS” is followed by “\r\n”, you’re treating that as “WINDOWS\r” followed by a “\n”, because “\n” is all you’re passing to strtok. There are several possible solutions, but one is passing “\r\n” to strtok instead.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I use this bit of code to feed some data i have parsed from
I have this bit of code I found on the web at the end
Well, I have this bit of code that is slowing down the program hugely
its a little bit hard to understand. in the header.php i have this code:
I have a bit of code that looks like this: text = reg.Replace(text, new
I have the following bit of code, simply: $(function() { $('a.add-photos-link').live('click', function(e) { $(this).colorbox({
I have a bit of php code like this: $test = <!--my comment goes
I have problems with the following bit of javascript/jquery code: this.droppable = function(){ $('.imageWindow
I am having a bit of difficulty with this current code I have set
Ok, so I have this nifty bit of code from Microsoft, and I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.