I am looking for a C / C++ or even C# code that will trim the first word of a each line in a text file
e.g. file.txt
test C:\Windows\System32\cacl.exe
download C:\Program Files\MS\
So I will be left with:
C:\Windows\System32\cacl.exe
C:\Program Files\MS\
I have the current code, but it doesnt seem to work:
#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;
}
1 Answer