Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

stracat(3pub) [debian man page]

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)
Man Page

10 More Discussions You Might Find Interesting

1. Programming

Recommend Books

Can anybody recommend a good (& maybe cheap :D ) book for c-prg in HP-UX. I a little rusty & most of expr is in PC world. (1 Reply)
Discussion started by: vslewis
1 Replies

2. UNIX for Dummies Questions & Answers

Scripting Help

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)
Discussion started by: ndoggy020
3 Replies

3. Shell Programming and Scripting

concatenate all duplicate line in a file.

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)
Discussion started by: vaskarbasak
30 Replies

4. Shell Programming and Scripting

Insert file names when concatenate files into a file

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)
Discussion started by: samky2005
2 Replies

5. Shell Programming and Scripting

How to concatenate this simple line in Unix?

(13 Replies)
Discussion started by: javygonx
13 Replies

6. Solaris

concatenate strings

(1 Reply)
Discussion started by: shankr3
1 Replies

7. Shell Programming and Scripting

Concatenate text between patterns in individual strings

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)
Discussion started by: Prev
12 Replies

8. Shell Programming and Scripting

Search for string in a file, extract two another strings and concatenate to a variable

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)
Discussion started by: garg
6 Replies

9. Shell Programming and Scripting

concatenate multiple file

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)
Discussion started by: rashmisb
2 Replies

10. UNIX for Dummies Questions & Answers

Concatenate two columns and separate by - (minus)

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)
Discussion started by: biopsy
13 Replies