How to print the src attribute of an ImageElement

"[email protected]" <[email protected]>
Newsgroups gmane.comp.mozilla.devel.dom
Organization http://groups.google.com
Message-ID <751fc82e-15af-44aa-afe3-be5996da082b@h11g2000prf.googlegroups.com>
Hi,

Can you please tell me how call I print out the src attribute of an
ImageElement to the screen?
I have the following code, but I only see 1 character 'h'.

nsCOMPtr<nsIDOMHTMLImageElement> img;

      if (img) {
        printf ( "img element is not null");

           nsAutoString srcAttr;

           img->GetAttribute(NS_LITERAL_STRING("src"), srcAttr);

           if (!srcAttr.IsEmpty()) {
             printf("%s", srcAttr.get());
           }
      }

Thank you for any help.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.