I want to get the file size downloaded by wget without actually downloading the file. So I use
wget --spider <url> 2>&1 | grep Length | awk '{print $2}'
and it works. But now my c program use this shell code by
int result = system("wget .....");
However, system return the exit status code which means result will be 0 instead of giving me the file size. How could I get this file size in my c programming code if I still want to use wget --spider? Thanks in advance!