STRACAT(3pub) C Programmer's Manual STRACAT(3pub)NAME
stracat - concatenate many strings into an allocated memory block
SYNOPSIS
#include <publib.h>
char *stracat(const char *s, ...);
DESCRIPTION
stracat will allocate a block of memory with malloc and concatenate all arguments strings into this block. The user is supposed to free
the returned block. The end of the argument list is signalled by a null pointer.
RETURN VALUE
stracat returns a pointer to the allocated block, or NULL if it could not be allocated.
EXAMPLE
To concatenate "hello, " and "world", one might say the following.
p = stracat("hello, ", "world", (char *)NULL);
if (p != NULL)
puts(p);
Please note that it is necessary to case NULL as in the example above,
since there is no information about the type of the argument available
in the prototype, and since an unadorned NULL might not be of the
correct type. (See any good C reference book or the comp.lang.c FAQ for
more information.)
SEE ALSO publib(3), strcat(3)AUTHOR
Lars Wirzenius (lars.wirzenius@helsinki.fi)
Publib C Programmer's Manual STRACAT(3pub)
Check Out this Related Man Page
XMALLOC(3pub) C Programmer's Manual XMALLOC(3pub)NAME
xmalloc, xrealloc, xfree, xstrdup, xmemdup, memdup - memory allocation functions for Publib
SYNOPSIS
#include <publib.h>
void *xmalloc(size_t bytes);
void *xrealloc(void *ptr, size_t bytes);
void xfree(void *ptr);
char *xstrdup(const char *string);
void *memdup(const void *mem, size_t bytes);
void *xmemdup(const void *mem, size_t bytes);
DESCRIPTION
These functions are utility functions for memory allocation from the publib library. xmalloc, xrealloc, and xfree are error checking ver-
sions of the standard library routines malloc, realloc, and free, respectively. They are guaranteed to never return unless there was no
problem: if, for example, xmalloc is unable to allocate the requested amount of memory, it prints an error message and terminates the pro-
gram. Hence, the caller does not need to check for a NULL return value, and the code that calls these functions is simpler due to the lack
of error checks.
Similarly, xstrdup is an error checking version of the common (though not standard) strdup routine, which creates a duplicate of a string
by allocating memory for the copy with malloc. (For systems that lack strdup, publib provides one in its portability module; it is always
declared in <publib.h>.)
memdup is similar to strdup, it creates a copy of an arbitrary memory area (the arguments are a pointer to the beginning of the area, and
its size) by allocating memory for the copy with malloc. xmemdup is its error checking version.
NOTE
xmalloc and xrealloc treat a request to allocate a block of 0 bytes as an error. xrealloc will allow its first argument to be NULL.
SEE ALSO publib(3), malloc(3), strdup(3)AUTHOR
Lars Wirzenius (lars.wirzenius@helsinki.fi)
Publib C Programmer's Manual XMALLOC(3pub)
Hello all.
Like Ive stated before, I am new to world of Unix. I was given the tast to create a script that will concatenate 20 files into one file. I know that the cat command is to be used but I am looking for something to get started on. Again, basically I need to wrtie a script that whill... (3 Replies)
Hi All,
i have a zip file like the format
794051400123|COM|24|0|BD|R|99.98
794051413727|COM|11|0|BD|R|28.99
794051415622|COM|23|0|BD|R|28.99
883929004676|COM|0|0|BD|R|28.99
794051400123|MOM|62|0|BD|R|99.98
794051413727|MOM|4|0|BD|R|28.99
794051415622|MOM|80|0|BD|R|28.99
... (30 Replies)
Hi
I found the following line would concatenate all test_01 test_02 test_03 files into "bigfile".
cat test_* >> bigfile
But, what I'm looking for a way to insert each file names in order when concatenated in "bigfile".
Thank you
samky2005 (2 Replies)
In any given file, wherever a certain data block exists I need to concatenate the values(text after each "=" sign) from that block. in that block. The block starts and ends with specific pattern, say BEGIN DS and END DS respectively. The block size may vary. A file will have multiple such blocks.... (12 Replies)
I have a file with
<suit:run date="Trump Tue 06/19/2012 11:41 AM EDT" machine="garg-ln" build="19921" level="beta" release="6.1.5" os="Linux">
Need to find word "build" then
extract build number, which is 19921 also
release number, which is 6.1.5 then
concatenate them to one variable as... (6 Replies)
Hi
Need some help to concatenate files
I have multiple spool files nearlly 15 of them which I need to concatenate like as shown in the below example
for ex.
file1.txt
aaaa|bbbbb|cccc|
dddd|eeee|ffff|
kkkkk|uuuuu|gggg|
file2.txt
xxxx|yyyy|zzzz|
1111||kkkk|lllll... (2 Replies)
hi all
could you please help me to concatenate two colomns and separate them by "-"
the two colomns to concatenate are colomuns 1 and 3 of a very bif file
clomn 1 is chr, 2 is snp and 3 is bp
the new colomn is chr_B
input file :
1 rs1111 10583
1 rs1891 10611
1 rs1807 ... (13 Replies)