git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28192
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
char tmpFile[512];
sprintf(tmpFile, "%s.tmp", argv[i]);
char tmpFile[512];
sprintf(tmpFile, "%s.tmp", argv[i]);
- fp = fopen(argv[i], "r");
+ fp = fopen(argv[i], "rb");
if (!fp)
{
fprintf(stderr, "Cannot open %s.\n", argv[i]);
i ++;
continue;
}
if (!fp)
{
fprintf(stderr, "Cannot open %s.\n", argv[i]);
i ++;
continue;
}
- outFile = fopen(tmpFile, "w");
+ outFile = fopen(tmpFile, "wb");
if (!outFile)
{
fprintf(stderr, "Cannot open %s.\n", tmpFile);
if (!outFile)
{
fprintf(stderr, "Cannot open %s.\n", tmpFile);
- while ((c = getc(ifp)) != EOF){
+ while ((c = getc(ifp)) != EOF)
+ {
- switch(d = getc(ifp)){ /* check to see if LF follows */
- case LF:
- putc(d,ofp); /* if so, ignore CR */
- break;
- default:
- putc(c,ofp); /* if not, output CR and following char */
- putc(d,ofp);
- } else putc(c, ofp); /* c is not a CR */
+ {
+ switch(d = getc(ifp))
+ { /* check to see if LF follows */
+ case LF:
+ putc(d,ofp); /* if so, ignore CR */
+ break;
+ default:
+ putc(c,ofp); /* if not, output CR and following char */
+ putc(d,ofp);
+ }
+ }
+ else
+ putc(c, ofp); /* c is not a CR */
/* Unix2DOS */
while ((c = getc(ifp)) != EOF){
if (c == CR)
/* Unix2DOS */
while ((c = getc(ifp)) != EOF){
if (c == CR)
putc(CR, ofp); /* add CR before each LF */
putc(c, ofp);
}
putc(CR, ofp); /* add CR before each LF */
putc(c, ofp);
}