I haven't used CGI myself, but seeing as CGI is a server side scripting language, and not created for these tasks, I'd doubt it's possible. What you can do however, is to use .NET and C# for this, but I have no experience with this at all.
If I were you, and really needed to use C to accomplish something in a browser based environment, I'd use Java. Java is much better suited for this, but you may consider the consquences of the loss of cross platform compatibility when you use platform specific C code.