Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- char* _simple_strtok(const char* pc, char delimeter)
- {
- static unsigned char* pOldString;
- static unsigned char* pString;
- static unsigned char* pWorkingString;
- static int iPosition;
- static int iOldPosition;
- char* cReturnCode = 0;
- if (!pc)
- {
- //if pc equals NULL use the old string from before
- pString = pOldString;
- }
- else if (pc)
- {
- pString = pc;
- }
- pWorkingString = pString;
- while ((pString[iPosition]!= '\0') && (pString[iPosition] != ';'))
- {
- iPosition++;
- }
- cReturnCode = (char*)calloc((iPosition - iOldPosition) + 1, sizeof(char));
- int i = sizeof(cReturnCode);
- //memcpy(cReturnCode, pString + iOldPosition, iPosition);
- strncpy(cReturnCode, pString + iOldPosition, iPosition);
- iOldPosition = iPosition+1;
- pOldString = pString + (iPosition - iOldPosition);
- return cReturnCode;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement