Any tool/script available to convert c99
style comments //
into c
style comments /* ..*/
into whole projects?
if i have code like this
// printf("stcakoverflow");
then it would be converted like
/* printf("stcakoverflow"); */
and also
int temp // this is temp varialbe
converted into
int temp /* this is temp varialbe */
For a command-line example, try e.g. something like this:
echo "int temp; // this is temp variable" | sed 's@//\(.*\)$@/*\1 */@'
The above results in
int temp; /* this is temp variable */
For a real file you could use e.g. cat
instead of echo
, it's the piping to sed
and the sed
command that does the "magic".
Edit: How to do it for lots of files
Something like this maybe:
cd /your/source/directory
mkdir converted-files
for f in *.cpp; do
cat $f | sed 's@//\(.*\)$@/*\1 */@' > converted-files/$f
done
Now all converted source files will be in a folder converted-files
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With