Given the following string 22E:77

I need to copy the characters from the string into another array up until it reaches the : character

I couldn't get this working properly with fgetc. Any help very much appreciated.