在下面的代码中,使用libxml库:
key = xmlNodeListGetString(doc, cur3->xmlChildrenNode, 1);
if (flag == 1)
{
image2 = key;
printf("the image 2 is %s \n", image2);
flag = 2;
}
if(flag == 0)
{
image1 = key;
printf("the image 1 is %s \n", image1);
flag = 1;
}
//printf("SRC of the file is: %s\n", key);
xmlFree(key);
printf("the image 1 is %s \n", image1);
Run Code Online (Sandbox Code Playgroud)
两个printf给了我不同的输出.
输出是:
the image 1 is 1.png
the image 1 is 0p? g
the image 2 is 2.png
the image 1 is 0p? g
Run Code Online (Sandbox Code Playgroud)