Re: delete comments in .c file
From: Colin Newell (colin_regacct)
Date: 10/31/03
- Next message: pete: "Re: Asking if elements in struct arre zero"
- Previous message: WENDY PRISCILLA PORTIER: "RE: Watch critical update which comes from the M$ Corporation"
- In reply to: Timex: "delete comments in .c file"
- Next in thread: Tim Hagan: "Re: delete comments in .c file"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 31 Oct 2003 12:27:45 -0000
Assuming you have access to the C preprocessor (cpp) you can do a quick hack
to use that. Isolate the file from it's include files and run like,
cpp -nostdinc file.c > new_file.c
It should warn that it cannot find all the include files. Now put your
#includes back in and you should have a comment free file.
This is a quick and dirty solution because the C preprocessor is trying to
do a whole load of stuff aswell as stripping comments. You need to make
sure that there are no #defines because otherwise they will be expanded out.
Put them back in after you have run the processor.
I have only come across the C preprocessor as a seperate program called
'cpp' on *nix boxes. It may be available on windows but I do not know where
or how.
Colin.
"Timex" <sugarfreed@hotmail.com> wrote in message
news:bnsegb$pi1$1@news.kreonet.re.kr...
> I want to delete all comments in .c file.
>
> Size of .c file is very big.
>
> Any good idea to do this?
>
> Please show me example code.
>
>
>
- Next message: pete: "Re: Asking if elements in struct arre zero"
- Previous message: WENDY PRISCILLA PORTIER: "RE: Watch critical update which comes from the M$ Corporation"
- In reply to: Timex: "delete comments in .c file"
- Next in thread: Tim Hagan: "Re: delete comments in .c file"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|