fbitonti
01-31-2007, 02:52 AM
Can some one tell me how to convert a string to a float?
$exampleFileName = ( "C:\\2dTrussMaterials.txt" );
float $i;
int $j=0;
// Now read it back one line at a time
//
$fileId=`fopen $exampleFileName "r"`;
string $nextLine = `fgetline $fileId`;
while ( size( $nextLine ) > 0 ) {
print ( $nextLine );
$i = $nextLine;
$nextLine = `fgetline $fileId`;
$j=$j+1;
}
fclose $fileId;
I am trying to store the string $nextLine in the float $i.
this is the error i get.
// Error: float $i;
//
// Error: Invalid redeclaration of variable "$i" as a different type. //
// Error: $i = $nextLine;
//
// Error: Cannot cast data of type string to int[]. //
Thanks for the help
$exampleFileName = ( "C:\\2dTrussMaterials.txt" );
float $i;
int $j=0;
// Now read it back one line at a time
//
$fileId=`fopen $exampleFileName "r"`;
string $nextLine = `fgetline $fileId`;
while ( size( $nextLine ) > 0 ) {
print ( $nextLine );
$i = $nextLine;
$nextLine = `fgetline $fileId`;
$j=$j+1;
}
fclose $fileId;
I am trying to store the string $nextLine in the float $i.
this is the error i get.
// Error: float $i;
//
// Error: Invalid redeclaration of variable "$i" as a different type. //
// Error: $i = $nextLine;
//
// Error: Cannot cast data of type string to int[]. //
Thanks for the help
