S
sc
Guest
On Feb 19, 7:18 am, bedo...@gmail.com wrote:
You can use popen. There is an example in C but it's very simple to
translate it to Skill.
#include <stdio.h>
#include <stdlib.h>
int main()
{
char buf[128];
FILE* f = _popen("wc -l test.txt", "rt");
if(f)
{
fgets(buf, 128, f);
printf("%s\n", buf);
_pclose(f);
}
return 0;
}
The result will be in the first output line like this '4 test.txt'.
There were 4 lines in test.txt.
Regards,
Hi,Thank you for your answer.
Indeed, i did a loop to count line by line.
I thought a more efficient way existed, like "wc -l" in unix !!!
but it's not the case ...
Thanks and Regards,
b.
You can use popen. There is an example in C but it's very simple to
translate it to Skill.
#include <stdio.h>
#include <stdlib.h>
int main()
{
char buf[128];
FILE* f = _popen("wc -l test.txt", "rt");
if(f)
{
fgets(buf, 128, f);
printf("%s\n", buf);
_pclose(f);
}
return 0;
}
The result will be in the first output line like this '4 test.txt'.
There were 4 lines in test.txt.
Regards,