10-19-2005
Hmm... benefit of the doubt then....
echo "ibase=10;obase=2;128" | bc
Where 128 is the number you want to convert.
I'll leave it to you to convert this into a versatile script.
Cheers
ZB
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi all,
I'm trying to convert a decimal number into an integer number; I'm doing this:
n=`echo |awk '{ print "'"$mem"'"*10}'`
where the variable mem is equal to 3.7
I'd like to obtain 37, but the expression above gives me 30.
Help please!!!!
thx a lot (4 Replies)
Discussion started by: idro
4 Replies
2. UNIX for Advanced & Expert Users
Hi All,
Is there any command which can convert binary decimal coded values to ascii values...
i have bcd values like below
оооооооооооо0о-- -v -
Pls suggest a way to convert this.
Thanks,
Deepti.Gaur (3 Replies)
Discussion started by: gaur.deepti
3 Replies
3. Shell Programming and Scripting
Hallo,
how can I convert number systems with bc?
I need to convert a decimal number to octal, dual or hex number... (2 Replies)
Discussion started by: wiseguy
2 Replies
4. Shell Programming and Scripting
The shell mentioned below will show a warning if the page takes more than 6 seconds to load.
The problem is that myduration variable is not an integer. How do I convert it to integer?
myduration=$(curl http://192.168.50.1/mantisbt/view.php?id=1 -w %{time_total}) > /dev/null ; ] && echo... (3 Replies)
Discussion started by: shantanuo
3 Replies
5. UNIX for Dummies Questions & Answers
Anybody please help me...
Design an algorithm that accepts an input a decimal number and converts it into BCD (Binary Coded Decimal) representation. Also, draw its Flow Chart.
This is a unix qn...
plz post algorithm for that :confused: (1 Reply)
Discussion started by: caramba
1 Replies
6. Homework & Coursework Questions
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
Design an algorithm that accepts an input a decimal number and converts it into BCD (Binary... (2 Replies)
Discussion started by: caramba
2 Replies
7. Shell Programming and Scripting
How to convert decimal value to hex and than take 1st digits as variable
sample data
84844294,5,6
51291736,2,3
84844294,5,6
51291736,2,3
i can use {printf "%x,%d\n",$1,$2} but than i want to filter base on 1st hex digit 1st recrd (1 Reply)
Discussion started by: before4
1 Replies
8. Shell Programming and Scripting
Hi All,
New to this forum (and yes , a newbie in programming..:p)
I have a decimal to binary converter script done this way :
i=$1
bit0=$(( (i & 0x01) > 0 ))
bit1=$(( (i & 0x02) > 0 ))
bit2=$(( (i & 0x04) > 0 ))
bit3=$(( (i & 0x08) > 0 ))
bit4=$((... (6 Replies)
Discussion started by: digiteltlc
6 Replies
9. Programming
Hello,
I have script which work fine on particular data.file .
The next feature I want to achieve is to get the decimal equivalent of data to data.
The data looks like this :
data(01000000000000000000110000000000)
thank you..
#include <iostream>
#include <fstream>
#include... (4 Replies)
Discussion started by: emily
4 Replies
10. UNIX for Beginners Questions & Answers
Is there a fast way to convert a negative decimal value into a signed binary number in bash script ? I've looked a lot on internet but I saw nothing... (For exemple : -1 become 11111111.) (9 Replies)
Discussion started by: Zedki
9 Replies
LEARN ABOUT PHP
draw_trans_rle_sprite
draw_trans_rle_sprite(3alleg4) Allegro manual draw_trans_rle_sprite(3alleg4)
NAME
draw_trans_rle_sprite - Draws a translucent RLE sprite. Allegro game programming library.
SYNOPSIS
#include <allegro.h>
void draw_trans_rle_sprite(BITMAP *bmp, const RLE_SPRITE *sprite, int x, int y);
DESCRIPTION
Translucent version of draw_rle_sprite(). See the description of draw_trans_sprite(). This must only be used after you have set up the
color mapping table (for 256-color modes) or blender functions (for truecolor modes). The bitmap and sprite must normally be in the same
color depth, but as a special case you can draw 32-bit RGBA format sprites onto any hicolor or truecolor bitmap, as long as you call
set_alpha_blender() first. Example:
/* Some one time initialisation code. */
COLOR_MAP global_trans_table;
create_trans_table(&global_trans_table, my_palette,
128, 128, 128, NULL);
...
if (get_color_depth() == 8)
color_map = &global_trans_table;
else
set_trans_blender(128, 128, 128, 128);
draw_trans_rle_sprite(buffer, rle_ghost_sprite, x, y);
SEE ALSO
draw_rle_sprite(3alleg4), draw_lit_rle_sprite(3alleg4), draw_trans_sprite(3alleg4), color_map(3alleg4), set_trans_blender(3alleg4),
set_alpha_blender(3alleg4), bitmap_mask_color(3alleg4)
Allegro version 4.4.2 draw_trans_rle_sprite(3alleg4)