Most of the source code looks alright with the exception of one statement. Dual-level pointer crc_s cannot be equated to uni-level pointer argv[i] as they are incompatible in terms of the pointer levels. crc_s is of type char** while argv[i] is of type char*.
Quote:
Originally Posted by VRoemer
Code:
int crcSpoof( char* file, char* fileOut, char* fileOutTmp, ulong* nRecovered, ulong* bytesRecovered, int** CRC_Array )
...
int main( int argc, char** argv )
{
int i = 3; // start with the 3rd value of argv
int** crc_s;
// Some argument testing here
while( argv[ i ] )
crc_s = argv[ i ]; /* the compiler will complain about this line */
crcSpoof( argv[1], argv[2], "fileOutTmp", NULL, NULL, crc_s );
Hi all,
In windows script, passing arguments can be done in both "call by value" and
"call by reference". Refer
http://www.commandline.co.uk/lib/treeview/index.php
Can we have call by reference in unix too?
Thanks in adavance,
Sonal. (5 Replies)
Hi,
I have a master BASH shell script where I define a bunch of variables:
$var1=why
$var2=is
$var3=(this so hard)
I would then like to call another shell script and pass these variables to it:
$script2 $var1 $var2 $var3
This works fine for var1 and var2. However, var3 is an array,... (9 Replies)
Hello,
Please tell me if there is a better way to get the number of elements from an array that is passed to a function.
This is what works on Solaris 8 (ksh) but it looks odd:
loop_array() {
array_name=$2
b1='\${\#'
b2='}'
nr_elements=`eval echo... (6 Replies)
Hi experts,
I am here again with another Issue.
I need to pass the array as parameter / argument to another script.
I tried it as follows . ( I got this idea from the link )
$ cat test1.sh
#! /usr/bin/ksh
set -a arr1
echo "...In Test1...."
arr1="APPS_DEV"
arr1="TEST_DEV"
echo... (16 Replies)
Let me know if there is a way to pass array to a funtion in ksh script.
function isPresent
{
typeset member
member=$1
dbList=$2
echo '$1:' $1
echo '$2' $dbList
The array will be at the second position....something like this
isPresent 12 <array>
if
then
echo... (3 Replies)
Hi ,
I have a script which is using a text file as I/P.
I want a code where it reads n lines from this file and pass the parameters to a function and now this script should run in such a way where a function can be called in parallel with different parameters. Please find below my script, it... (1 Reply)
I have a question on how can I assign a output of a function to a variable which is executed in background.
Here is my example
$ cat sample_program.sh
#!/bin/ksh
exec_func () {
sleep 1
v=`expr $1 + 100`
print $v
}
export OUT_ARR
date
for i in 1 2
do
OUT_ARR=`exec_func $i` &... (1 Reply)
Hi All
I have multiple arrays like below.
set -A val1 1 2 4 5
set -A val2 a b c d
.
.
.
Now i would like to pass the individual arrays one by one to a function and display/ do some action.
Note : I am using ksh
Can you please advise any solution...
Thanks in advance. (7 Replies)
Hi,
I am creating filesystem for block device, but I want to pass array value one by one acording to block device count.
$tmp1 = block device count 3
$blockdevice =
So I want to first pass sdb1 alone in loop, how to take only block device seprately from $blockdevice array. (1 Reply)
Hello,
I think there's an easier way to do this but can't seem to recall but given an array of animals and an initial value is a random index in the array, here it's 3.
3,4,5,4,3,2,1,0,1,2,3,4,5,4,3,2,1,0... inifinite repeat
a quick brute force solution i came up with was two functions, i... (6 Replies)
Discussion started by: f77hack
6 Replies
LEARN ABOUT REDHAT
crc32
crc32(n) Cyclic Redundancy Check (crc32) crc32(n)
NAME
crc32 - Perform a 32bit Cyclic Redundancy Check
SYNOPSIS
package require Tcl 8.2
package require crc32 ?1.0?
::crc::crc32 ?-format format? ?-seed value? ?-implementation procname? message
::crc::crc32 ?-format format? ?-seed value? ?-implementation procname? -filename file
DESCRIPTION
This package provides a Tcl-only implementation of the CRC-32 algorithm based upon information provided at http://www.naaccr.org/stan-
dard/crc32/document.html If the Trf package is available then the crc-zlib command is used to perform the calculation.
COMMANDS
::crc::crc32 ?-format format? ?-seed value? ?-implementation procname? message
::crc::crc32 ?-format format? ?-seed value? ?-implementation procname? -filename file
The command takes string data or a file name and returns a checksum value calculated using the CRC-32 algorithm. The result is for-
matted using the format(n) specifier provided or as an unsigned integer (%u) by default.
OPTIONS -filename name
Return a checksum for the file contents instead of for parameter data.
-format string
Return the checksum using an alternative format template.
-seed value
Select an alternative seed value for the CRC calculation. The default is 0xffffffff. This can be useful for calculating the CRC for
data structures without first converting the whole structure into a string. The CRC of the previous member can be used as the seed
for calculating the CRC of the next member.
Note that as the Trf command crc-zlib cannot accept a seed value, use of this option will force the use of the Tcl only implementa-
tion.
-implementation procname
This hook is provided to allow users to provide their own implementation (perhaps a C compiled extension) or to explicitly request
use of the Tcl only implementation when Trf is installed (by setting -implementation crc::Crc32_tcl. The procedure specfied is
called with two parameters. The first is the data to be checksummed and the second is the seed value. A 32bit integer is expected as
the result.
EXAMPLES
% crc::crc32 "Hello, World!"
3964322768
% crc::crc32 -format 0x%X "Hello, World!"
0xEC4AC3D0
% crc::crc32 -file crc32.tcl
483919716
SEE ALSO
sum(n), cksum(n)
AUTHORS
Pat Thoyts
KEYWORDS
cksum, checksum, crc, crc32, cyclic redundancy check, data integrity, security
crc 1.0 crc32(n)