删除C语言代码中的所有注释

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

#!/usr/bin/perl -w
my $c_file = $ARGV[0];
my $c_file_out = $ARGV[1];
open(CF,"<$c_file");
my @cf = <CF>;
close CF;
my $cf = join '',@cf;
$cf =~ s/((?<=\n)|^)[ \t]*\/\*.*?\*\/\n?|\/\*.*?\*\/|((?<=\n)|^)[ \t]*\/\/[^\n]*\n|\/\/[^\n]*//gs;
open(OUT,">$c_file_out");
print OUT "$cf";
close OUT;