Convert into C program


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Convert into C program
# 1  
Old 05-31-2010
Convert into C program

Hi,

in this forum I was able to find a logic written by perderabo to write packed decimals. the code works fine. However, I would want to convert it to a c program. so as to do that I am not able to understand the below mentioned logic. Can someone please help me understand that?

Code:
if ((packswitch)) ; then
                char1=$dig
                octal=16#${char1}${char2}
                result=${octal#??}
                echo packing $olength $char1 $char2 $octal $result
                output[olength]=$(print -n \\${result})
                ((olength=olength-1))

        else
                char2=$dig
        fi

Link to perderabo's code
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Perl program get a response before the program quits

I created a program, so a kid can practice there math on it. It dispenses varies math problems and the kid must input an answer. I also want it to grade the work they have done, but I can't find the best place for it to print out the grade. I have: if ( $response =~ m/^/ ) { $user_wants_to_quit... (1 Reply)
Discussion started by: germany1517
1 Replies

2. Programming

Urgent help needed.. C++ program to convert decimal to hexa decimal

Hi , seq can be 0...128 int windex = seq / 8; int bindex = seq % 8; unsigned char bitvalue = '\x01' << (7-bindex) ; bpv.bitmapvalue = bitvalue; This is the part of a program to convert decimal to bitmap value of hexadecimal. I want this to change to convert only to... (1 Reply)
Discussion started by: greenworld123
1 Replies

3. Shell Programming and Scripting

Convert perl program to shell

Hi is there a way that i can convert this simple perl program into shell script #!usr/bin/perl -w use strict; use warnings; open INPUTFILE, "uniqprobecoordinates.out" || die "canot open the file $!"; open OUTPUTFILE, ">", "1_4reads.out"; while(<INPUTFILE>) { chomp; ... (3 Replies)
Discussion started by: bhargavpbk88
3 Replies

4. Programming

C program - convert values based on the position

Hey! I'm new to C. I need to covert certain values using C. please see the below. I have figured out the logic to do it. Please provide some hints to do this with C Logic: If first position of POS = 0, shift POS to the left one byte. If third position of POS = 0, move spaces to third... (1 Reply)
Discussion started by: rocker_me2002
1 Replies

5. Shell Programming and Scripting

Perl program to convert PDF to text/CSV

Please suggest ways to easily convert pdf to text in perl only on windows (no other tools can be downloaded) Here is what I have been doing : using a module CAM::PDF to extract data. But it shows everything in messy format :wall: But this module is the only one working with the pdf... (0 Replies)
Discussion started by: chakrapani
0 Replies

6. Shell Programming and Scripting

convert ksh to C program

Hi Guys...is there a way to convert a .ksh script to .C program..? (3 Replies)
Discussion started by: aggars
3 Replies

7. UNIX for Dummies Questions & Answers

Script to open program and send/execute command in program

Hi, i want to write a script that executes a program (exec?) . this program then requires a filename as input. how do i give it this input in the script so the program will be complete run and close by the script. e.g. exec prog.exe program then asks for filename "enter filename:"... (1 Reply)
Discussion started by: tuathan
1 Replies

8. Shell Programming and Scripting

please convert the below program into shell script

if ( ( grep -i "Exception : " /home/dklog* )) then echo " improper combination" elsif ( ( grep -i "invalid" /home/dklog*)) then echo " wrong process " fi fi in the above case i am facing the the syntx error please help in this case... (3 Replies)
Discussion started by: mail2sant
3 Replies

9. Shell Programming and Scripting

convert cpp program to c shell script ?

Hi guys I tried to convert this c++ code to c shell script but there are some bugs and I don't know how to solve it. This code prints the three variables in decreasing order: int main() { int x,y,z; cin >> x >> y >>z; if ( x < y ) if ( x < z ) if ( y < z ) cout << x <<" " <<... (2 Replies)
Discussion started by: domain
2 Replies

10. UNIX for Dummies Questions & Answers

How a program to convert '|' delimited file into excel?

Hi All, I want to convert a '|' delimited file to excel file. I want it is an automated process (this means I need not to open excel, import and choose '|' delimited, then ... to generate an excel) I need to use a scripts or proram to convert the file. Do any one have this tools? A... (11 Replies)
Discussion started by: wilsonchan1000
11 Replies
Login or Register to Ask a Question
CHRPATH(1)						 change rpath/runpath in binaries						CHRPATH(1)

NAME
chrpath - change the rpath or runpath in binaries SYNOPSIS
chrpath [ -v | --version ] [ -d | --delete ] [ -r <path> | --replace <path> ] [ -c | --convert ] [ -l | --list ] [ -h | --help ] <program> [ <program> ... ] DESCRIPTION
chrpath changes, lists or removes the rpath or runpath setting in a binary. The rpath, or runpath if it is present, is where the runtime linker should look for the libraries needed for a program. OPTIONS
-v | --version Display program version number -d | --delete Delete current rpath or runpath setting -c | --convert Convert the rpath setting into a runpath setting -r <path> | --replace <path> Replace current rpath or runpath setting with the path given -k | --keepgoing Do not fail on first error, but process all arguments before returning the error. -l | --list List the current rpath or runpath (default) -h | --help Show usage information. EXIT STATUS
0 If all operations were successful >0 if one of the operations failed. A failing operation terminates the program unless -k is specified. AUTHOR
The chrpath program was written by Petter Reinholdtsen <pere@hungry.com>, based on works by Geoffrey Keating <geoffk@ozemail.com.au> and Peeter Joot <peeterj@ca.ibm.com>. This manual page was originally written by Tollef Fog Heen <tfheen@debian.org>, for the Debian GNU/Linux system (but may be used by oth- ers). chrpath May 4, 2002 CHRPATH(1)