Example #1
0
int VMPI_getchar_unlocked()
{
    return _getchar_nolock();
}
Example #2
-1
int main(int argc, char *argv[])
{
//	system("chcp 65001");
	system("chcp 1251");

	// Read HTML file contents
	std::string htmlFileName = "C:\\Projects\\__DATA\\test_page_30.html";
	std::ifstream htmlFileStream(htmlFileName, std::ios::in | std::ios::binary);
	if (!htmlFileStream)
	{
		std::cout << "File " << htmlFileName << " not found!";
		return( EXIT_FAILURE );
	}

	std::string htmlFileContents;
	htmlFileStream.seekg(0, std::ios::end);
	htmlFileContents.resize(htmlFileStream.tellg());
	htmlFileStream.seekg(0, std::ios::beg);
	htmlFileStream.read(&htmlFileContents[0], htmlFileContents.size());
	htmlFileStream.close();

	// Convert it to UTF-8
	// NOTE: Gumbo works ONLY with UTF-8 documents
	char* bufUtf8 = new char[htmlFileContents.length() * 2];
	memset(bufUtf8, 0, htmlFileContents.length() * 2);
	cp1251ToUtf8(bufUtf8, htmlFileContents.c_str());
//	delete[] bufUtf8;
//	return 0;

	// Parse web page contents
	GumboOutput* output = gumbo_parse(/*htmlFileContents.c_str()*/ bufUtf8 );
//    search_for_links(output->root);
	searchForDivBlocks(output->root);

	gumbo_destroy_output(&kGumboDefaultOptions, output);

	delete[] bufUtf8;
	_getchar_nolock();
	return 0;
}