From: Kit Li <kwl...@ya...> - 2009-08-14 13:06:45
|
The binary files I get are saved in a Linux environment and I copied them to my XP. Then I run my decoder on a msys shell and got an exception back from XP pointing to an error from ntdll.dll. I do use the "rb" flag in fopen, written in c, and compiled using the mingw gcc compiler version 3.4.5. I thought it was the size of the file so I attempted to use head to get whatever amount of data I could to smaller size and surprise that it worked. One of the binary files has about 6.3mm lines per head, others have various number of lines per head. I then did a head -6500000 binary.file > new.binary.file(to get all lines) and my decoder can read and decode it fine. The output matches the same version in the Linux environment. I then tried "cat binary.file > new.binary.file" in the same msys shell and that worked too. That got me to wonder if head and cat in msys append or strip away certain characters invalid to MinGW C. I just started c/c++ development in an XP environment, please excuse me if I'm not clear with my description. Thanks. --- On Thu, 8/13/09, Tor Lillqvist <tm...@ik...> wrote: From: Tor Lillqvist <tm...@ik...> Subject: Re: [Mingw-users] Reading binary binary files originated from Linux in XP To: "MinGW Users List" <min...@li...> Date: Thursday, August 13, 2009, 3:11 PM > I have a question about reading binary files(1.4gb in size) through fopen() > and fread(). The binary files I have originated from a Linux environment > and I can't read them as is. Why not? What kind of errors do you get? You do open the files in binary mode (fopen(filename, "rb")) I hope? In what way did you copy the files to your Windows machine? Is it possible they got corrupted already in the copying process? > I thought something was wrong w/ my fread or > the file size. However, when I run the head command from Msys to get all > the lines out to a temp file or use cat, then I can read the file fine. You say the files are binary, still you talk about "lines" which of course is a concept relevant to text files only. Also the "head" command is meaningful for text files only. Please explain more what kind of data the files contain. --tml ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ MinGW-users mailing list Min...@li... This list observes the Etiquette found at http://www.mingw.org/Mailing_Lists. We ask that you be polite and do the same. Most annoying abuses are: 1) Top posting 2) Thread hijacking 3) HTML/MIME encoded mail 4) Improper quoting 5) Improper trimming _______________________________________________ You may change your MinGW Account Options or unsubscribe at: https://lists.sourceforge.net/lists/listinfo/mingw-users |