You need to learn how to do some basic debugging. If you think there is something wrong with strlen() then you should have determined the value that was actually being provided by strlen(). If you did that then you would know that there is nothing wrong with strlen().