You can't put the getSerialString() function from JHaskell's blog in the middle of another function. No function can be declared inside another function.
I don't think it will work properly if you change Serial.read() to Wire.read(). WIRE messages are generally fixed length.
You are sending a variable-length message containing '%', some digits, and '&'. You might get better results bysending the 'int' rather than a text representation of the 'int':
Wire.send((char *)&b, sizeof b);
Then you can receive it with:
int val;
Wire.requestFrom(8, sizeof val);
if (Wire.available())
{
val = Wire.read() << 8 | Wire.read();
}