From: Simon Krahnke Date: 2007-08-15T00:04:59+09:00 Subject: Re: [C ext to Ruby] how to output a octal coded number ??? * unbewust (10:46) schrieb: > that's OK for input of octal number if for example, from ruby the user > write : > > this_file.perms = 0777 (then with the first 0) > > i get the right number > > however, for the time being, i'm returning, for the same value : > 777 instead of 0777 when the user wants to read the perms,, then my > question how to return within a C est to Ruby an integer coded in > octal ??? A integer in ruby is a numeric value, it's not octal or decimal. > thought, at that time i'm usinbg INT2FIX ( ) A string representation of a number can be octal or decimal or whatever. The Ruby as well and the C library have means to convert between numbers and its string representations. num = "775".to_i(8) dec = num.to_s #> "509" oct = num.to_s(8) #> "775" mfg, simon .... l > best > > Yvon BTW: The german word unbewusst is written with two s. :-)