【发布时间】:2011-08-22 21:14:08
【问题描述】:
我目前在一个 txt 文件中的行中有数百个文件路径,我需要删除例如
report2011510222820.html: <td width="60%" bgcolor="#f4f4f4" class="tablebody" valign="top">C:\Users\Administrator\Desktop\calc.exe</td>
我怎么能取出“report2011510222820.html: &lt;td width="60%" bgcolor="#f4f4f4" class="tablebody" valign="top"&gt;" and "&lt;/td&gt;”,所以我只剩下:
C:\Users\Administrator\Desktop\calc.exe
我拥有的当前代码:
#include <stdio.h>
#include <string.h>
int main(int argc, char *argv[])
{
char s[2048];
while (fgets(s, sizeof(s), stdin))
{
char *pos = strpbrk(s, "|\r\n");
if (pos != 0)
fputs(pos+1, stdout);
}
return 0;
}
【问题讨论】:
-
#include <stdio.h> #include <string.h> int main(int argc, char *argv[]) { char s[2048]; while (fgets(s, sizeof(s), stdin)) { char *pos = strpbrk(s, "|\r\n"); if (pos != 0) fputs(pos+1, stdout); } return 0; } -
这是我目前的代码
-
@pavium 嗨,我想有人为我编辑过
-
一定要在
C做吗?家庭作业?