I'm listing files and sorting them. When I try to get length of array variable in which these files are stored I get 1 as value. That's weird.
When I loop through the array it works fine. But when I want to print length of array it print 1.
When I debug it with -x, I see '\n'
May be new line character is messing length?
Hi
How to sort a fixed length file on a given char range and just display the duplicates.
I did search for man sort to find any option but could find any.,something similar to cut -c 1-5,25-35.
I have alternate way of doing this by using combination of cut,awk. but this
creates extra temp... (6 Replies)
I'm trying to find the longest word in /usr/share/dict/words
The first thing I can think of is to sort the content by length then it would be easy to find out, but then i realize theres no option of sort to sort by length.
Could you guys please give me some help?:confused: (7 Replies)
I have a 1250 byte record that I need to sort in column 10-19 and in column 301. I have tried the sort command, but it looks like it needs delimiters to work. The record can have spaces in a lot of its 1250 columns, but 10-19, and 301 are guaranteed. These columns are numeric too.
A sample... (1 Reply)
I was trying to use the AIX 6.1 sort command to sort fixed-length data records, sorting by specific columns only. It took some time to figure out how to get it to work, so I wanted to share the solution. The sort man page wasn't much help, because it talks about field delimeters (default space... (1 Reply)
I've been searching high and low for this...but, maybe I'm just missing something. I have a file to be sorted that, unfortunately, contains binary data at the end of the line. As you may guess, this binary data may contain a newline character, which messes up the sort. I think I could resolve this... (5 Replies)
Hello All,
I have this script that does stuff like "starting, stopping & restarting" a Daemon Process running on my machine...
My main question is why in part of my code (which you will see below) does the Array Length (i.e. ${#PIDS} )
return "1" when I know the Array is empty..?
Here is... (17 Replies)
Hi,
I want to be able to sort/print a hash based on the string length of the values.
For example
%hash = (
key1 => 'jeri',
key2 => 'corona',
key3 => 'una,
);
I want to be able to print in the following order (smallest to largest)
una,jeri,corona
OR... (1 Reply)
Hi Experts,
Quick quesion:
I want to sort this in the file , but not working, when using # sort file name
305.932
456.470
456.469
456.468
456.467
172.089
456.467
456.466
456.465
111.573
111.578
111.572
111.572
87.175
87.174
75.898 (4 Replies)
Hello;
When I wrote a function to print out an array,
void p_array(int arr)
{
int i;
int size = sizeof(arr) / sizeof(int);
// int size = sizeof (arr) / sizeof (arr);
for (i = 0; i < size; i++)
printf("%d ", arr);
printf("\n");
}I could only print out the... (19 Replies)
Discussion started by: yifangt
19 Replies
LEARN ABOUT CENTOS
tcl_newbytearrayobj
Tcl_ByteArrayObj(3) Tcl Library Procedures Tcl_ByteArrayObj(3)__________________________________________________________________________________________________________________________________________________NAME
Tcl_NewByteArrayObj, Tcl_SetByteArrayObj, Tcl_GetByteArrayFromObj, Tcl_SetByteArrayLength - manipulate Tcl objects as a arrays of bytes
SYNOPSIS
#include <tcl.h>
Tcl_Obj *
Tcl_NewByteArrayObj(bytes, length)
void
Tcl_SetByteArrayObj(objPtr, bytes, length)
unsigned char *
Tcl_GetByteArrayFromObj(objPtr, lengthPtr)
unsigned char *
Tcl_SetByteArrayLength(objPtr, length)
ARGUMENTS
const unsigned char *bytes (in) The array of bytes used to initialize or set a byte-array object.
int length (in) The length of the array of bytes. It must be >= 0.
Tcl_Obj *objPtr (in/out) For Tcl_SetByteArrayObj, this points to the object to be converted to byte-array type. For
Tcl_GetByteArrayFromObj and Tcl_SetByteArrayLength, this points to the object from which to
get the byte-array value; if objPtr does not already point to a byte-array object, it will be
converted to one.
int *lengthPtr (out) If non-NULL, filled with the length of the array of bytes in the object.
_________________________________________________________________DESCRIPTION
These procedures are used to create, modify, and read Tcl byte-array objects from C code. Byte-array objects are typically used to hold
the results of binary IO operations or data structures created with the binary command. In Tcl, an array of bytes is not equivalent to a
string. Conceptually, a string is an array of Unicode characters, while a byte-array is an array of 8-bit quantities with no implicit
meaning. Accessor functions are provided to get the string representation of a byte-array or to convert an arbitrary object to a byte-
array. Obtaining the string representation of a byte-array object (by calling Tcl_GetStringFromObj) produces a properly formed UTF-8
sequence with a one-to-one mapping between the bytes in the internal representation and the UTF-8 characters in the string representation.
Tcl_NewByteArrayObj and Tcl_SetByteArrayObj will create a new object of byte-array type or modify an existing object to have a byte-array
type. Both of these procedures set the object's type to be byte-array and set the object's internal representation to a copy of the array
of bytes given by bytes. Tcl_NewByteArrayObj returns a pointer to a newly allocated object with a reference count of zero. Tcl_SetByteAr-
rayObj invalidates any old string representation and, if the object is not already a byte-array object, frees any old internal representa-
tion.
Tcl_GetByteArrayFromObj converts a Tcl object to byte-array type and returns a pointer to the object's new internal representation as an
array of bytes. The length of this array is stored in lengthPtr if lengthPtr is non-NULL. The storage for the array of bytes is owned by
the object and should not be freed. The contents of the array may be modified by the caller only if the object is not shared and the call-
er invalidates the string representation.
Tcl_SetByteArrayLength converts the Tcl object to byte-array type and changes the length of the object's internal representation as an
array of bytes. If length is greater than the space currently allocated for the array, the array is reallocated to the new length; the
newly allocated bytes at the end of the array have arbitrary values. If length is less than the space currently allocated for the array,
the length of array is reduced to the new length. The return value is a pointer to the object's new array of bytes.
SEE ALSO
Tcl_GetStringFromObj, Tcl_NewObj, Tcl_IncrRefCount, Tcl_DecrRefCount
KEYWORDS
object, byte array, utf, unicode, internationalization
Tcl 8.1 Tcl_ByteArrayObj(3)