Thursday, 4 December 2014

Unexpected output: strtok

I was reading up on the differences between Java and C++ (as I have used the former the most recently and wouldn't want to wonder why declaring an array in the Java way in a C++ file was causing errors in a side project I'm working on). 

One of the things pointed out was to read up on the strtok function (splitting up a String into tokens based on a delimiter) as it works quite differently than how it works in Java. So I read through it that evening - it does work very differently, so if I have to use it I need to remember to be careful when doing so. 

The next day I looked at my laptop and found this:

Tokens everywhere! Something must have gone wrong...

(My son had found a pile of Magic: The Gathering tokens and decided they needed moving)