Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!wuarchive!udel!haven!mimsy!mojo!russotto From: russotto@eng.umd.edu (Matthew T. Russotto) Newsgroups: comp.sys.mac.programmer Subject: Re: Import Binary Date File from PC Message-ID: <1991Feb7.023618.17175@eng.umd.edu> Date: 7 Feb 91 02:36:18 GMT References: <21958@duke.cs.duke.edu> Sender: news@eng.umd.edu (C-News) Organization: College of Engineering, Maryversity of Uniland, College Park Lines: 35 In article <21958@duke.cs.duke.edu> fang@physics.phy.duke.edu (Fang Zhong) writes: > > I use a PC to automate my experiment. I store my data on the PC in >binary format as: > > >> fp = fopen(filename, "ab"); >> fwrite(&data, sizeof(float), 1,fp); >> fclose(fp); > >I can use: > >> fread(&data, sizeof(float), 1, fp); > >to read the data back on PC. I plot my data with Igor on Mac. However, if >I use the same line > >> fread(&data, sizeof(float), 1, fp); > >to read the data on Mac after the data has been imported via "default >translation" of Apple File Exchange, I get garbage. The same is true when >I generate binary data on Mac and read it back on PC. This problem exits >regardless which mode I use in AFE. > > Can some experts on the network point out what I didn't right? > Thanks in advance. The floating format of Macs and IBM PCs are simply NOT the same. Write out your floats as ASCII values, or find out the float format and write a routine to convert on the mac. (it may be simply byte-order reversals) How do you read this file in IGOR, BTW? -- Matthew T. Russotto russotto@eng.umd.edu russotto@wam.umd.edu .sig under construction, like the rest of this campus.