On Fri, 1 May 1998, Benjamin Draper wrote: ->Might need [NEWBIE] up there. Indeed. ->Right, I'm helping someone setup a MUD in Linux, and I'm doing much of ->the work offline on my WIN95 machine. Problems arise when files have ->been transfered from WIN95 to linux. As I understand it, files that ->I've altered with DOS edit or WORDPAD, are going to be saved in text ->format (obvisouly), but gcc prefers them to be binary. Eh, no. gcc, like any other compiler, takes a text file and produces a binary. The only problem I can forsee is the difference between the end line sequences in DOS/Windows and UNIX. DOS puts "\r\n" at the end of a line in a file for a return/new-line, while UNIX only needs a "\n". I don't think gcc will have any problems compiling files that have "\r\n" pairs, but most UNIX-based editors will display the "\r" as some special character, and other programs may or may not like them. So, the suggestion is to strip the files of the "\r" using any of a hundred different methods. You can even write a little program to do it yourself (although there already exists way to do it), Mailer Code(tm) as usual: #include <stdio.h> #incldue <stdlib.h> #include <unistd.h> int main(int argc, char ** argv) { FILE * fp, * nfp; char tmp[256]; --argc, ++argv; if (!argc) { fprintf(stderr, "What file do you want to strip?\n"); return 1; } if (!(fp = fopen(argv[0], "r"))) { fprintf(stderr, "Failed to open '%s'\n", argv[0]); return 1; } else if (feof(fp)) return 0; sprintf(tmp, "%s.tmp", argv[0]); if (!(nfp = fopen(tmp, "w"))) { fprintf(stderr, "Failed to create '%s'\n", tmp); return 1; } do { if (!fgets(tmp, 256, fp)) break; tmp[strlen(tmp)-2] = '\n'; tmp[strlen(tmp)-1] = '\0'; fputs(tmp, nfp); } while (!feof(fp)); fclose(fp); fclose(nfp); sprintf(tmp, "%s~", argv[0]); rename(argv[0], tmp); sprintf(tmp, "%s.tmp", argv[0]); rename(tmp, argv[0]); } There's probably an even easier way to write this program. Actually, if I could ever remember how 'tr' works...:)~ -dak +------------------------------------------------------------+ | Ensure that you have read the CircleMUD Mailing List FAQ: | | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html | +------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/15/00 PST