Go Back   AC3D Forums > Technical > AC3D Developers
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 4th July 2005, 08:43 AM   #1
epajarre
Junior Member
Member
 
Join Date: Jun 2003
Posts: 17
Default object-data in AC3D file

I have been writing and reading AC3D files with other programs, during this I have sometimes wondered about some minor issues with the "data" block in AC3D file (like should the last newline be in data be counted to the data length).

Now I have been thinking more about newline characters in "data". It looks like that the "data" block should be considered binary data because going for example Linux <-> Windows will change the number of charactes in "newlines", and thus break the data block. On the otherhand this is a shame because using AC3D file as a text file would be nice for version control programs etc.

Any comments/ideas?

Eero
epajarre is offline   Reply With Quote
Old 4th July 2005, 12:23 PM   #2
Thaellin
Senior Member
Professional user
 
Join Date: Jun 2003
Location: British Columbia, Canada
Posts: 255
Default

If you are reading the fine in text mode, then the getline function will cope with the platform-specifics of an EOL character. The only reason you would have a problem is if you are doing binary access on the file.
-- Jeff
Thaellin is offline   Reply With Quote
Old 4th July 2005, 01:12 PM   #3
epajarre
Junior Member
Member
 
Join Date: Jun 2003
Posts: 17
Default

Yes but in the AC3d File format:

---
*data %d

Optional - object data. Usually the object-data string for an object.
The parameter is an interger which specifies the number of characters
(starting on the next line) to be read.
---

So you cannot just simply read the data section line by line, instead you have to read %d characters from the file. (Of course you can still read it line by line, but in order to know where to stop you have to count the characters) And this causes the problem on how to count end of lines (2 characters in Dos/windows one character in Unix/Mac).

Now as I have been checking my code it looks like everything works ok if the count in data is the "UNIX" count of characters. Even if the file is actually "windows text mode". So maybe the only problem (if there is a problem) is in the documentation.
epajarre is offline   Reply With Quote
Old 4th July 2005, 02:21 PM   #4
Thaellin
Senior Member
Professional user
 
Join Date: Jun 2003
Location: British Columbia, Canada
Posts: 255
Default

It's been a while since I wrote a reader for AC, but what you are saying sounds familiar. I think I had to experiment on this point as well.

Tech docs could definitely use a brush up.
-- Jeff
Thaellin is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT -4. The time now is 11:37 AM.


AC3D Forum
(C) Inivis Limited 2020