Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/130.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 这个c+有什么问题+;html整洁程序_C++_Htmltidy - Fatal编程技术网

C++ 这个c+有什么问题+;html整洁程序

C++ 这个c+有什么问题+;html整洁程序,c++,htmltidy,C++,Htmltidy,我已经编译了一个c程序,我得到了一个错误,这是他们给出的一个示例程序 #include "tidy/tidy.h" #include <stdio.h> #include <errno.h> int main(int argc, char **argv ) { const char* input = "<title>Foo</title><p>Foo!"; TidyBuffer output = {0}; TidyBuf

我已经编译了一个c程序,我得到了一个错误,这是他们给出的一个示例程序

#include "tidy/tidy.h"
#include <stdio.h>
#include <errno.h>


int main(int argc, char **argv )
{
  const char* input = "<title>Foo</title><p>Foo!";
  TidyBuffer output = {0};
  TidyBuffer errbuf = {0};
  int rc = -1;
  Bool ok;

  TidyDoc tdoc = tidyCreate();                     // Initialize "document"
  printf( "Tidying:\t%s\n", input );

  ok = tidyOptSetBool( tdoc, TidyXhtmlOut, yes );  // Convert to XHTML
  if ( ok )
    rc = tidySetErrorBuffer( tdoc, &errbuf );      // Capture diagnostics
  if ( rc >= 0 )
    rc = tidyParseString( tdoc, input );           // Parse the input
  if ( rc >= 0 )
    rc = tidyCleanAndRepair( tdoc );               // Tidy it up!
  if ( rc >= 0 )
    rc = tidyRunDiagnostics( tdoc );               // Kvetch
  if ( rc > 1 )                                    // If error, force output.
    rc = ( tidyOptSetBool(tdoc, TidyForceOutput, yes) ? rc : -1 );
  if ( rc >= 0 )
    rc = tidySaveBuffer( tdoc, &output );          // Pretty Print

  if ( rc >= 0 )
  {
    if ( rc > 0 )
      printf( "\nDiagnostics:\n\n%s", errbuf.bp );
    printf( "\nAnd here is the result:\n\n%s", output.bp );
  }
  else
    printf( "A severe error (%d) occurred.\n", rc );

  tidyBufFree( &output );
  tidyBufFree( &errbuf );
  tidyRelease( tdoc );
  return rc;
}

TidyBuffer结构是在Tidy library头文件
buffio.h
中声明的,因此如果您也包括它,它应该可以工作

顶部的“包含”应如下所示:

#include <tidy.h>
#include <buffio.h>
#include <errno.h>
#包括
#包括
#包括

您是否正在使用他们的名称空间(如果他们有名称空间的话)以及是否可以发布指向该示例的链接?
#include <tidy.h>
#include <buffio.h>
#include <errno.h>