Ad
  • Default User Avatar

    User "gradyplayer" suggested in the comments that you check if the return value ends with a '\0'. I think that's a good suggestion, because it's best practice for functions that return C strings to null-terminate them.

  • Default User Avatar

    My code was ridiculously similar to yours, haha.