Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Force 4.0 Reference - tokenptr() return a token from a string pointer http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 tokenptr()          Return a token from a string pointer
------------------------------------------------------------------------------
 Declaration
   string.hdr

 Syntax
   func char tokenptr extern
   param value ulong pString, ;
         value byte  bSeparator, ;
         value uint  uPosition

 Arguments
   pString is a pointer to a string to scan for tokens.

   bSeparator is a token separator character.

   uPosition is the index of token to retrieve.

 Return
   The uPosition-th token from pString.

 Description
   The tokenptr() function retrieves a token from the input string
   (supplied as a memory pointer), as specified by the token separator
   character and the token position parameters. Consecutive occurrences of
   the separator character result in separate empty tokens.

 Example
   #define EXAMPLE_STRING
   #include example.hdr

   proc Test_tokenptr
   vardef
      ptr( char ) pMem
      uint        n
   enddef
   pMem := malloc( 100 )                            // allocate memory
   *pMem := "one/two/three/four/five/six"           // copy string
   for n := 1 to 6
      ? tokenptr( pMem, '/', n )                    // get tokens
   next
   free( pMem )                                     // free buffer
   endproc

   proc main
   Test_tokenptr()
   endproc

See Also: token() word()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson