The write to a line is address (in Hex) 0x80 for 1st line, 0xc0 for second line, any subsequent write to a line will increment the position, if you want to write to a particular char in either line, then add the posn to either 0x80 or 0xc0.
I don't use C so I cannot help very much with the...