找回密码 注册 QQ登录
一站式解决方案

iCAx开思网

CAD/CAM/CAE/设计/模具 高清视频【积分说明】如何快速获得积分?在线3D打印服务,一键上传,自动报价 
查看: 17613|回复: 6
打印 上一主题 下一主题

[讨论] double型怎样转换成char型附源码

[复制链接]
跳转到指定楼层
1
发表于 2009-12-25 12:00:50 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

马上注册,结交更多同行朋友,交流,分享,学习。

您需要 登录 才可以下载或查看,没有帐号?注册

x
//////////////////////////////////////////////////////////////////////////////
//
//  5.cpp
//
//  Description:
//      Contains Unigraphics entry points for the application.
//
//////////////////////////////////////////////////////////////////////////////
//  Include files
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <uf.h>
#include <uf_disp.h>
#include <uf_modl.h>
#include <uf_ui.h>
#include <uf_object_types.h>
#if ! defined ( __hp9000s800 ) && ! defined ( __sgi ) && ! defined ( __sun )
# include <strstream>
#   include <iostream>
using std:strstream;
using std::endl;
using std::ends;
using std::cerr;
#else
# include <strstream.h>
#   include <iostream.h>
#endif
#include "6.h"
//----------------------------------------------------------------------------
//  Activation Methods
//----------------------------------------------------------------------------
//  Unigraphics Startup
//      This entry point activates the application at Unigraphics startup
extern "C" DllExport void ufsta( char *param, int *returnCode, int rlen )
{
    /* Initialize the API environment */
    int errorCode = UF_initialize();
    if ( 0 == errorCode )
    {
  tag_t block_max;
  double block_orig[3]={0.0,0.0,0.0};
  double x=100.0,y=100.0,z=100.0;
  char   mx [256];
  char   my [256];
  char   mz [256];
  char * block_len[3];
  sprintf(mx,"x的边长是:%f\n",x);
  sprintf(my,"y的边长是:%f\n",y);
  sprintf(mz,"x的边长是:%f\n",z);
  UF_UI_open_listing_window();
  UF_UI_write_listing_window(mx);
  UF_UI_write_listing_window(my);
  UF_UI_write_listing_window(mz);
  block_len[0]=mx;
  block_len[1]=my;
  block_len[2]=mz;

  UF_FEATURE_SIGN sign=UF_NULLSIGN;
  UF_MODL_create_block1(sign,block_orig,block_len,&block_max);
        errorCode = UF_terminate();
    }
    /* Print out any error messages */
    PrintErrorMessage( errorCode );
}
//----------------------------------------------------------------------------
//  Utilities
//----------------------------------------------------------------------------
// Unload Handler
//     This function specifies when to unload your application from Unigraphics.
//     If your application registers a callback (from a MenuScript item or a
//     User Defined Object for example), this function MUST return
//     "UF_UNLOAD_UG_TERMINATE".
extern "C" int ufusr_ask_unload( void )
{
    return( UF_UNLOAD_UG_TERMINATE );
}
/* PrintErrorMessage
**
**     Prints error messages to standard error and the Unigraphics status
**     line. */
static void PrintErrorMessage( int errorCode )
{
    if ( 0 != errorCode )
    {
        /* Retrieve the associated error message */
        char message[133];
        UF_get_fail_message( errorCode, message );
        /* Print out the message */
        UF_UI_set_status( message );
        // Construct a buffer to hold the text.
        ostrstream error_message;
        // Initialize the buffer with the required text.
        error_message << endl
                      << "Error:" << endl
                      << message
                      << endl << endl << ends;
     // Write the message to standard error
        cerr << error_message.str();
    }
}
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖 赞一下!赞一下!
2
发表于 2009-12-25 13:03:39 | 只看该作者

马上注册,结交更多同行朋友,交流,分享,学习。

您需要 登录 才可以下载或查看,没有帐号?注册

x
3
发表于 2009-12-25 13:06:10 | 只看该作者

马上注册,结交更多同行朋友,交流,分享,学习。

您需要 登录 才可以下载或查看,没有帐号?注册

x
4
发表于 2009-12-25 13:06:20 | 只看该作者

马上注册,结交更多同行朋友,交流,分享,学习。

您需要 登录 才可以下载或查看,没有帐号?注册

x
5
 楼主| 发表于 2009-12-25 13:17:56 | 只看该作者

马上注册,结交更多同行朋友,交流,分享,学习。

您需要 登录 才可以下载或查看,没有帐号?注册

x
6
 楼主| 发表于 2009-12-25 13:25:09 | 只看该作者

马上注册,结交更多同行朋友,交流,分享,学习。

您需要 登录 才可以下载或查看,没有帐号?注册

x
7
 楼主| 发表于 2009-12-25 13:46:09 | 只看该作者

马上注册,结交更多同行朋友,交流,分享,学习。

您需要 登录 才可以下载或查看,没有帐号?注册

x
您需要登录后才可以回帖 登录 | 注册

本版积分规则

3D打印手板模型快速制作服务,在线报价下单!

QQ 咨询|手机版|联系我们|iCAx开思网  

GMT+8, 2024-9-21 02:34 , Processed in 0.024645 second(s), 11 queries , Gzip On, Redis On.

Powered by Discuz! X3.3

© 2002-2024 www.iCAx.org

快速回复 返回顶部 返回列表