View Single Post
Old 1st November 2013, 02:08 AM   #10
Blue Baron
Junior Member
Junior member
 
Join Date: Aug 2013
Posts: 6
Default Re: Plugin: Another OBJ Importer/Exporter

Quote:
Originally Posted by jentron View Post
I see how that should work, but the exception isn't being caught on my build. I'm not good enough with C++ to figure out why (yet)
So is the CStrList::LoadFromFile function not returning on the throw line, and the plugin is crashing before returning? or is the function returning, but the plugin is crashing before/after the error message?

If the first case, you might want to try adding a return statement after the throw line. Or adding a return value, replacing the throw line with a return statement and replacing the try-catch lines in CObj::LoadFromFile with an if statement.


Quote:
Originally Posted by jentron View Post
Line 128 is only stripping the carriage return from the end of the line. I think the problem is on line 116:
FILE *fp = fopen( filename, "rt" );

I don't think Linux supports the "t" or splitting the file on \r only, so later line 123:
while( fgets( dataline, maxchars - 1, fp ) != NULL )

ends up getting maxchars - 1 each pass.
You're right, I misread the code.

Since the OS is not translating \r to \n, the best option might be to convert the file yourself. I did a search for "mac carriage return line feed" and the pages at http://en.wikipedia.org/wiki/Newline and http://www.danielmiessler.com/study/crlf/ have commands to do this.

Otherwise you would have to find/write a fgets replacement that stops on \r.
Blue Baron is offline   Reply With Quote