C++ Program to convert single line comment into multi-line comment

While developing compression utility, we come across such a weired issues while converting .php extension file as php can be started at any position and have some really tough task for us to compress.

To overcome that issue, we decided to convert single line comment into multi-line comments and then remove all the comments from our final output. Here is the source code written in C++ to convert all single-line comments ( C/C++ style ) into multi-line comments.

/* 	program to convert single line comment into multi-line comment 
	Developed by		   :	rakesh kumar
	
*/
#include
#include
using namespace std;
//function to convert single line comment into multiline comment
void convert_single(char source[], char dest[]){
	ifstream fin(source);
	ofstream fout(dest);
	char ch;
	while(fin.get(ch)){
		if(ch=='/')
		  {
			//strcpy(line,ch);
			fout<

Above program takes "single.cpp" file as its input and produce a file "temp.cpp" as its output file. If you have any other solution to this problem then let us know.

%d bloggers like this: