XtNewString man page on HP-UX

Man page or keyword search:  
man Server   10987 pages
apropos Keyword Search (all sections)
Output format
HP-UX logo
[printable version]

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()
[top]

List of man pages available for HP-UX

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net