Sponsored Content
Full Discussion: ltoa Behavior
Operating Systems HP-UX ltoa Behavior Post 302079916 by jim mcnamara on Thursday 13th of July 2006 05:54:27 PM
Old 07-13-2006
From the ltoa man page
Code:
 WARNINGS
      The return values for ltostr(), ultostr(), ltoa() and ultoa() point to
      data whose content is overwritten by subsequent calls to these
      functions by the same thread.

You're referencing the same place in memory twice... therefore you're experiencing undefined behavuior - sometimes it works, other times not.
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Telnet behavior

Hi there, I've an stupid question. If I make a telnet to a server from my computer and then execute a command that starts an application (on the server), when I disconnect, the application stops running, which is pretty obvious. Is it possible to add a flag at the end of the command so when I cut... (4 Replies)
Discussion started by: piltrafa
4 Replies

2. Programming

ls behavior

I put this here because it is a 'behavior' type question.. I seem to remember doing ls .* and getting all the .-files, like .profile .login etc. But ls .* doesn't do that, it lsts the contents of every .*-type subdirectory. Is it supposed to? I should think that a -R should be given to... (10 Replies)
Discussion started by: AtleRamsli
10 Replies

3. Programming

Behavior of pthreads

Hi All, I ve written a small program to get started off with pthreads. I somehow feel the program doesnt meet the purpose. Please find the code and the output below. Please find my question at the bottom. #include <pthread.h> #include <stdio.h> #include <stdlib.h> void *PrintThread1(void... (4 Replies)
Discussion started by: nhrraj
4 Replies

4. Shell Programming and Scripting

sed behavior on hp-ux

the sed command: sed 's/^*//' file does not work on HP-UX :-( but it works fine on Linux, content of file: <tab><tab>hello output should be: hello Any ideas?? Thank you Andy (8 Replies)
Discussion started by: andy2000
8 Replies

5. Shell Programming and Scripting

Echo behavior

Echo is removing extra blank spaces. See the command. export INSTALLDIR=”First Second /Two Space” echo $INSTALLDIR out put: First Second /Two Space Here only on blnak space is present while with command Echo “$INSTALLDIR” Out put: ”First Second /Two Space” It's correct output... (2 Replies)
Discussion started by: Saurabh78
2 Replies

6. Programming

Strange behavior in C++

I have the following program: int main(int argc, char** argv){ unsigned long int mean=0; for(int i=1;i<10;i++){ mean+=poisson(12); cout<<mean<<endl; } cout<<"Sum of poisson: "<< mean; return 0; } when I run it, I get the... (4 Replies)
Discussion started by: santiagorf
4 Replies

7. HP-UX

Unusual Behavior?

Our comp-operator has come across a peculiar ‘feature'. We have this directory where we save all the reports that were generated for a particular department for only one calendar year. Currently there are 45,869 files. When the operator tried to backup that drive it started to print a flie-listing... (3 Replies)
Discussion started by: vslewis
3 Replies

8. AIX

LUN Behavior

Aix 6.1, working with a nim master and nim_altmaster both LPARS have access to the same data LUN, /nimdisk I do realize the risks of having 2 servers access the same LUN, however it serves the purpose of being able to restore mksysb's to/from our DR site if necessary, at least in theory ;) ... (3 Replies)
Discussion started by: mshilling
3 Replies

9. UNIX for Dummies Questions & Answers

Weird behavior of Vi

Hi there, I am a bit puzzled by a weird behavior of Vi. I very simply would like to add increased numbers in some files. Since I have many thousands entries per file and many files, I would like to macro it in vi. To do this, I enter the first number ("0001") on the first line and then yank... (4 Replies)
Discussion started by: hypsis
4 Replies
NL_LANGINFO(3P) 					     POSIX Programmer's Manual						   NL_LANGINFO(3P)

PROLOG
This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (consult the correspond- ing Linux manual page for details of Linux behavior), or the interface may not be implemented on Linux. NAME
nl_langinfo, nl_langinfo_l -- language information SYNOPSIS
#include <langinfo.h> char *nl_langinfo(nl_item item); char *nl_langinfo_l(nl_item item, locale_t locale); DESCRIPTION
The nl_langinfo() and nl_langinfo_l() functions shall return a pointer to a string containing information relevant to the particular lan- guage or cultural area defined in the current locale, or in the locale represented by locale, respectively (see <langinfo.h>). The mani- fest constant names and values of item are defined in <langinfo.h>. For example: nl_langinfo(ABDAY_1) would return a pointer to the string "Dom" if the identified language was Portuguese, and "Sun" if the identified language was English. nl_langinfo_l(ABDAY_1, loc) would return a pointer to the string "Dom" if the identified language of the locale represented by loc was Portuguese, and "Sun" if the identified language of the locale represented by loc was English. The nl_langinfo() function need not be thread-safe. The behavior is undefined if the locale argument to nl_langinfo_l() is the special locale object LC_GLOBAL_LOCALE or is not a valid locale object handle. RETURN VALUE
In a locale where langinfo data is not defined, these functions shall return a pointer to the corresponding string in the POSIX locale. In all locales, these functions shall return a pointer to an empty string if item contains an invalid setting. The application shall not modify the string returned. The pointer returned by nl_langinfo() might be invalidated or the string content might be overwritten by a subsequent call to nl_langinfo() in any thread or to nl_langinfo_l() in the same thread or the initial thread, by subsequent calls to setlocale() with a category corresponding to the category of item (see <langinfo.h>) or the category LC_ALL, or by sub- sequent calls to uselocale() which change the category corresponding to the category of item. The pointer returned by nl_langinfo_l() might be invalidated or the string content might be overwritten by a subsequent call to nl_langinfo_l() in the same thread or to nl_lang- info() in any thread, or by subsequent calls to freelocale() or newlocale() which free or modify the locale object that was passed to nl_langinfo_l(). ERRORS
No errors are defined. The following sections are informative. EXAMPLES
Getting Date and Time Formatting Information The following example returns a pointer to a string containing date and time formatting information, as defined in the LC_TIME category of the current locale. #include <time.h> #include <langinfo.h> ... strftime(datestring, sizeof(datestring), nl_langinfo(D_T_FMT), tm); ... APPLICATION USAGE
The array pointed to by the return value should not be modified by the program, but may be modified by further calls to these functions. RATIONALE
The possible interactions between internal data used by nl_langinfo() and nl_langinfo_l() are complicated by the fact that nl_langinfo_l() must be thread-safe but nl_langinfo() need not be. The various implementation choices are: 1. nl_langinfo_l() and nl_langinfo() use separate buffers, or at least one of them does not use an internal string buffer. In this case there are no interactions. 2. nl_langinfo_l() and nl_langinfo() share an internal per-thread buffer. There can be interactions, but only in the same thread. 3. nl_langinfo_l() uses an internal per-thread buffer, and nl_langinfo() uses (in all threads) the same buffer that nl_langinfo_l() uses in the initial thread. There can be interactions, but only when nl_langinfo_l() is called in the initial thread. FUTURE DIRECTIONS
None. SEE ALSO
setlocale(), uselocale() The Base Definitions volume of POSIX.1-2008, Chapter 7, Locale, <langinfo.h>, <locale.h>, <nl_types.h> COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1, 2013 Edition, Standard for Information Technol- ogy -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, Copyright (C) 2013 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. (This is POSIX.1-2008 with the 2013 Technical Corrigendum 1 applied.) In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Stan- dard is the referee document. The original Standard can be obtained online at http://www.unix.org/online.html . Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html . IEEE
/The Open Group 2013 NL_LANGINFO(3P)
All times are GMT -4. The time now is 05:22 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy