Then something like this might be usefull:
Code:
#include <stdio.h>
int main(int argc, char** argv)
{
FILE *ifp, *ofp;
int hold_eol = 0;
char ch;
if(argc != 3){
printf("Usage: %s <infile> <outfile>\n", argv[0]);
return -1;
}
if(!(ifp=fopen(argv[1], "r"))){
printf("Error opening file %s for reading\n", argv[1]);
return -1;
}
if(!(ofp=fopen(argv[2], "w"))){
printf("Error opening file %s for writing\n", argv[2]);
return -1;
}
while(EOF!=(ch=fgetc(ifp))){
if(ch == '\"')
if(hold_eol)
hold_eol = 0; /* we exit a quote container */
else
hold_eol = 1; /* we enter a quote container */
if(ch == '\n' && hold_eol)
ch=' '; /* replace eol with space */
fprintf(ofp, "%c", ch); /* print current char to file */
}
fclose(ifp);
fclose(ofp);
return 0;
}
I think it is quite easy to transform into some PHP code... Since PHP syntax is very much like C/C++ and the PHP API provides almost identical library functions.