PDA

View Full Version : How to read large text files into maya.


Nenox
10-12-2005, 11:35 PM
Hi. I'm trying to read in the contents of a mel script file from disk. I do this using the fread command. It works ok, BUT the fread apparentely has a max read of 1024 characters. Since most my scripts are longer than that, i need another method.

Any help?

Thanks!

phantastikfan
10-13-2005, 08:59 AM
Hi. I'm trying to read in the contents of a mel script file from disk. I do this using the fread command. It works ok, BUT the fread apparentely has a max read of 1024 characters. Since most my scripts are longer than that, i need another method.

Any help?

Thanks!

Try that piece of code:


$hdFile = `fopen $strFileName "r"`;
while(!feof($hdFile))
{
$g_strFileContent += `fgetline $hdFile`;
}
fclose $hdFile;

Nenox
10-13-2005, 11:55 AM
Will do!

Thank you. :-)

CGTalk Moderation
10-13-2005, 11:55 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.