Notifications
Clear all

[Closed] Filestream question

So I noticed something odd.

When I run the following code in 3ds Max 2012 or earlier, these are the results I get:


test = openfile "C:\Users\Malkalypse\AppData\Local\Autodesk\3dsMax\2012 - 64bit\ENU\3dsmax.ini"
-- result: <File:C:\Users\Malkalypse\AppData\Local\Autodesk\3dsMax\2012 - 64bit\ENU\3dsmax.ini>
skiptostring test "C"
-- result: OK
readLine test
-- result: "urrentHeight=-1"

test2 = openfile "C:\Users\Malkalypse\AppData\Local\Autodesk\3dsMax\2013 - 64bit\ENU\3dsmax.ini"
-- result: <File:C:\Users\Malkalypse\AppData\Local\Autodesk\3dsMax\2013 - 64bit\ENU\3dsmax.ini>
skiptostring test2 "C"
-- result: undefined

In Max 2013, the skiptostring after test2 returns OK, and the following readline returns “urrentHeight=-1”. Max 2013 will also return the expected results for 2014-2017.

As far as I can tell, the only difference in the .ini files from 2013 on is an empty line at the start. However, when I tried adding an empty line at the start of the 2012 .ini file, it still worked just fine in earlier versions.

Why is this occurring and is there any way around it?

3 Replies

So this is also kinda weird:

iniFile = openFile "C:\Users\Malkalypse\AppData\Local\Autodesk\3dsmax\2017 - 64bit\enu\3dsmax.ini"
skipToString iniFile "CurDir="
readLine iniFile

RESULTS:
<File:C:\Users\Malkalypse\AppData\Local\Autodesk\3dsmax\2017 - 64bit\enu\3dsmax.ini>
undefined
"þ"

EDIT:

Also, based on the following, they would appear to be loading at the end of the file:

 iniFile:     <File:C:\Users\Malkalypse\AppData\Local\Autodesk\3dsmax\2009 - 64bit\enu\3dsmax.ini>
 eof iniFile: false

 iniFile:     <File:C:\Users\Malkalypse\AppData\Local\Autodesk\3dsmax\2017 - 64bit\enu\3dsmax.ini>
 eof iniFile: true

It is due to Character Encoding, which was introduced in Max 2013. So Max 2013 and newer versions can read/write Unicode but Max 2012 and older cannot.

You may want to take a look here for more details.

Absolutely!

I remember a post about ‘making a universal compiling setup’ for all versions of max…
it was big thing added from 2012 to 2014 (i’m counting even versions)…

all string related code was changed form TSTR to MSTR… something was continuing to work, but most of code had to be rewritten because of that…

i’ve tried to use #if
it was working. but it made my code too messy
and i’ve decided just start a new coding life – with UNICODE