Hi all, I'm writing a Mozilla component to get all the links from a page an write them into a file using XPCOM and C++. I get all the links into an array like this:
//doc is a pointer to nsIDOMDocument
doc->GetElementsByTagName(NS_LITERAL_STRING("A"), getter_AddRefs(nodeList));
nodeList->GetLength(&nodeNumb);
href = new nsEmbedString[nodeNumb];
for(PRUnit32 i=0; i< nodeNumb; i++){
nsCOMPtr<nsIDOMNode> aNode;
nodeList->Item(i, getter_AddRefs(aNode));
nsCOMPtr<nsIDOMHTMLAnchorElement> anchor = do_QueryInterface(aNode);
if(anchor){
(*outLinks)++;
href[i] = anchor->GetHref(tempHref);
}
} // end of for
but now how can I get them write to a file. I'm really clue less how to work with file in XPCOM. Can some one please give me some hints or links to tutorials please?