hpux man page for xtnewstring

Query: xtnewstring

OS: hpux

Section: 3

Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar

XtNewString()															     XtNewString()

Name
  XtNewString - copy an instance of a string.

Synopsis
  String XtNewString(string)
	 String string;

Inputs
  string    Specifies a NULL-terminated string.

Returns
  A copy of string in allocated memory.

Description
  XtNewString()  allocates enough memory to hold a copy of the specified string and copies the string into that memory.  If there is insuffi-
  cient memory to allocate the new block, XtNewString() prints an error message and terminates the application by calling XtErrorMsg().

Usage
  Memory allocated with XtNewString() must be deallocated with XtFree().

  To simply allocate a specified amount of memory, use XtMalloc().  To allocate enough memory for one  instance  of  a	specified  type,  use
  XtNew().

Example
  You might use XtNewString() in a situation like this:

     String name = XtNewString(XtName(w));

  XtName() returns a string that may not be modified.  If you copy it, however, you can do anything you like with it, as long as you remember
  to free it when you are done with it.

Background
  XtNewString() is defined as the following macro:

     #define XtNewString(str) #define XtNewString(str)	   ((str) != NULL ? (strcpy(XtMalloc((unsigned)strlen(str) + 1),
	 str)) : NULL)

See Also
  XtMalloc(1), XtFree(1), XtNew(1).

Xt - Memory Allocation														     XtNewString()
Related Man Pages
xtmalloc(3xt) - xfree86
xtfree(3) - x11r4
xtnew(3) - x11r4
xtfree(3) - suse
xtnewstring(3) - suse
Similar Topics in the Unix Linux Community
How to list file size on HPUX?
PHP Man Pages Now Available (Over 10,000)
Is UNIX an open source OS ?
Sequence extraction
Hpux 11iV3 administration document