I am quite new to C (I am more used to C++) and I am trying to create an IRC Bot. I am currently struggling to find the correct string parsing functions to parse this line:
:nick!~username@server PRIVMSG #channel :message (could contain the word PRIVMSG)
So, I am asking if anyone could show me what functions I would use to split up this line into:
Thanks for any help!
I'd probably use sscanf. Something on this general order seems to be a reasonable starting point:
char nick[32], user[32], server[32], channel[32], body[256];
sscanf(buffer, ":%31[^!]!~%31[^@]@%31s PRIVMSG #%31s :%255[^\n]",
nick, user, server, channel, body);