PDA

View Full Version : need some help with a fileimport with variables line.


dbmata
11-08-2006, 09:09 PM
Hey folks, I'm having the hardest time with this, and I've not been getting anywhere... I know I am missing something, but I don't know what...

I would greatly appreciate help!


proc importFile($fileName,$fileType)
{
file -import -rpr "$fileName" "C:/script/" + $fileType + ".obj";
}


importFile(soccerPitch,soccer);


Now, I'm trying to go this route, and it's not working too hotly...


proc importFile($fileType)
{
str $fileLoc = "C:/script/" + $fileType + ".obj";
file -import $fileLoc;
}


importFile(soccer);

JamesPiechota
11-08-2006, 11:54 PM
proc importFile ( string $fileType)
{
string $fileLoc = ("C:/script/" + $fileType + ".obj");
file -import $fileLoc;
}


importFile( "soccer" );

I made a few changes to the code.


Procedure parameters should have their type defined - string $fileType as opposed to just $fileType
The data type for a string is string as opposed to str
When adding strings together you may need to enclose it all in parentheses
Not always necessary, but to be safe I've added quotes around the string soccer

CGTalk Moderation
11-08-2006, 11:54 PM
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.