Oh, ok, I was declaring buffer as a pointer. Could that be what messed it all up?