Find first bit in word - ffb.c
# ./ffb
first bit(0xDEADBEAF): 0
first bit(0xDEADBEA0): 5
first bit(0xDEADBE00): 9
first bit(0xDEADB000): 12
first bit(0xDEAD0000): 16
create a daemon and redirect output to logfile - pcreate.c
cat > daemon.sh << EOF
#!/bin/sh
while [ 1 ]; do date; sleep 1; done
EOF
# chmod +x daemon.sh
# gcc -o pcreate pcreate.c
# ./pcreate ./daemon.sh logfile.log
# tail -f logfile.log
program to print U-Boot environment variables - ubootenv.c
hexdump of U-Boot env partition - uboot.env
# gcc -o ubootenv ubootenv.c
# ./ubootenv uboot.env
CRC32: 0xE2A77069
Active Flag: 0x01
bootdelay=0
baudrate=115200
download_baudrate=115200
....
Euclid's Algorithm to find GCD (gcd.c)
# gcc -o gcd gcd.c
# ./gcd 12345 56789
gcd of 12345 and 56789 is 1
sieve of Eratosthenes to find prime numbers (prime.c)
# gcc -o prime prime.c
# ./prime 100
2 3 5 7 11 13 17 19 23 29
31 37 41 43 47 53 59 61 67 71
73 79 83 89 97
Tottal number: 25
Simple client/Server communication (server1.c, client1.c)
Simple client/Server communication (server2.c, client2.c)
Simple client/Server communication (server3.c, client3.c)
# gcc -o server serverX.c
# gcc -o client clientX.c
# ./server 5555
Here is the message: hello server
# ./client localhost 5555
Please enter the message: hello server
from server time: Tue Nov 23 05:06:08 2010
Reference:
good one!
ReplyDelete