31 lines
1.0 KiB
Plaintext
31 lines
1.0 KiB
Plaintext
local fn DoIt
|
|
NSUInteger i
|
|
CFStringRef s
|
|
CFArrayRef x = @[@1, @2, @3, @1e11]
|
|
CFArrayRef y = @[@1, @1.4142135623730951, @1.7320508075688772, @316227.76601683791]
|
|
CFMutableStringRef mutStr = fn MutableStringWithCapacity(0)
|
|
|
|
CFURLRef desktopURL = fn FileManagerURLForDirectory( NSDesktopDirectory, NSUserDomainMask )
|
|
CFURLRef url = fn URLByAppendingPathComponent( desktopURL, @"Array_to_file.txt" )
|
|
|
|
for i = 0 to 3
|
|
if ( i < 3 )
|
|
s = fn StringWithFormat( @"%ld \t", fn NumberIntegerValue( x[i] ) )
|
|
MutableStringAppendString( mutStr, s )
|
|
s = fn StringWithFormat( @"%.4f\n", fn NumberFloatValue( y[i] ) )
|
|
MutableStringAppendString( mutStr, s )
|
|
else
|
|
s = fn StringWithFormat( @"%.e\t", fn NumberFloatValue( x[i] ) )
|
|
MutableStringAppendString( mutStr, s )
|
|
s = fn StringWithFormat( @"%.4e\n", fn NumberFloatValue( y[i] ) )
|
|
MutableStringAppendString( mutStr, s )
|
|
end if
|
|
next
|
|
fn StringWriteToURL( mutStr, url, YES, NSUTF8StringEncoding, NULL )
|
|
print mutStr
|
|
end fn
|
|
|
|
fn DoIt
|
|
|
|
HandleEvents
|