The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
.
google unix.com



High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Migration from HP-UX to Solaris/Linux turaga.krishna HP-UX 6 02-28-2009 07:29 PM
Migration Solaris 10 10/08 x86/x64 from UFS to ZFS (Russian) iBot Solaris BigAdmin RSS 0 01-08-2009 09:30 AM
Solaris migration mohanpadamata UNIX for Advanced & Expert Users 1 06-11-2008 05:23 AM
Migration Solaris 5.8 to 10 bruno_a_correia SUN Solaris 2 08-26-2007 08:17 PM
problem with sprintf snprintf in Solaris diganta SUN Solaris 7 12-24-2004 07:41 AM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 05-04-2009
coldas57 coldas57 is offline
Registered User
  
 

Join Date: Apr 2009
Posts: 3
solaris appl migration: sprintf decimal separator

Hi,

I am trying to migrate an application from Solaris to AIX 5.3.1. In both platforms the locale settings are as follows:

Result of executing "locale"
LANG=C
LC_CTYPE="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_COLLATE="C"
LC_MONETARY="C"
LC_MESSAGES="C"

In solaris when you execute this program (this is a sample, in the original code there are lots of classes but at the end they call sprintf function to fill a char[] variable):

Code:
#include <string.h>
#include <stdlib.h>
#include <stdio.h>

int main(int argc, char * argv[])
{
    char cadena[25];
    double a = 0;

    memset(cadena,0,sizeof(cadena));

    sprintf(cadena, "%-f", a);
    printf("The content is : %s\n", cadena);
}
In AIX I am compiling this code (main.cpp) with:

IBM XL C/C++ Enterprise Edition for AIX, V9.0
Version: 09.00.0000.0007


In solaris the output is :

0,000000 -> with a comma separator

But in AIX when I try to execute this, the result is:

0.000000 -> with a point separator

I am trying to migrate the code having in mind the idea of not touching the original code. Any idea?,

Thank you in advance for your attention and time.
David
 

Bookmarks

Tags
aix, migration, solaris

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 12:31 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0