|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
Ruby to C help
Hi,
First time post, hopefully this won't hurt too bad... I have the following Ruby function, def convert(num) return [num].pack("N")[1,3] end My question is what would the equivalent C function of this be? More specifically I have an idea of what it does, but I'm not completely sure. Any and all help would be appreciated. -Arbituator |
|
#2
|
|||
|
|||
|
What that function does is converts an ASCII code to a character. You can also do this in Ruby with simply "num.chr".
In C, you don't need a function to do this, you can cast num to a character: Note, however, that this C "equivalent" returns a char, not a string. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Ruby Programming > Ruby to C help |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|