pude to přes sscanf
http://www.cplusplus.com/ref/cstdio/sscanf.html