From: cwalsh AT nf DOT sympatico DOT ca (Colin Walsh) Newsgroups: comp.os.msdos.djgpp Subject: Re: Writing a struct to disk Date: 26 Aug 97 20:05:22 GMT Organization: Colossal Software Lines: 80 Approved: By the Department of Silly Walks Distribution: world Message-ID: <34033702.0@204.101.95.15> References: Reply-To: cwalsh AT nf DOT sympatico DOT ca NNTP-Posting-Host: 204.101.95.15 Cc: djgpp AT delorie DOT com To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk > So, if you want a text file to be portable to Unix, you should write > it in binary mode on MS-DOS, so it doesn't have those CRs. Last night I did up a program to do exactly this (It was to convert a Unix mail file into DOS CR/LF text so Eudora could read it). Hope this counts as an ObHack too (It kinda falls into the definition of a hack :) #include #include long filelen(char *name) { long len=0; fstream file(name,ios::in|ios::bin); while(!file.eof()) { file.get(); len++; } len--; file.close(); return(len); } void main(int argc,char **argv) { cout << "UNIX2DOS DOS/UNIX Text file converter" << endl; cout << "Free (F) 1997 COLOSSAL Software" << endl; if(argc<3) { cout << "Not enough arguments!" << endl; cout << "format : unix2dos