my first paralle routine

1, 新建 delcrlf.cpp

2, 编写代码

#include <string>
#include <cstring>
#include <iostream>
#include <exception>

using namespace std;

char* delnewline(char *);

char* delnewline(char *badStr)
{
    try
    {
    
        string crow = badStr;
        int ilen = crow.size();

        char *p = new char[ilen+1];

        unsigned char fst = ' ';
        
    	  for(int i = 0; i < ilen; ++i)
		    {
		        fst = (unsigned char)crow.at(i);
		        if( fst == 0x0A or fst == 0x0D ) 
		        {
		          p[i] = ' ';
		        } else {
		          p[i] = crow[i];
		        } ;		    
		    }

		    p[ilen]='\0';	    
		    return p;
        
    }
    catch(exception& e)
    {
        char *p = new char[5];
        p[0] = '[';
        p[0] = '@';
        p[0] = '#';
        p[0] = ']';
        p[1] = '\0';
        return p;
    }
    catch(...)
    {
        char *p = new char[5];
        p[0] = '[';
        p[0] = '@';
        p[0] = '#';
        p[0] = ']';
        p[1] = '\0';
        return p;
    }
}

int main ( void ) {
  char *ins = "1234";
  char *out = delnewline(ins);
  string ss = out ; 
  cout << ss << endl; 
}

3, 编译看程序能否运行

 
  g++ -o delcrlf delcrlf.cpp
  ./delcflf

  确认是否有结果输出,如有,则表明C++程序无问题


4, 去除cpp文件中的 main 部分

5,创建makefile , 代码如下:

rm -f orchsort.o;
cp  /app/dssrv/Ascential/DataStage/PXEngine/lib/orchsort.o ./

rm -f orchgeneral.o;
cp  /app/dssrv/Ascential/DataStage/PXEngine/lib/orchgeneral.o ./

rm -rf delcrlf.o
rm -rf delcrlf_tmp.o

xlC -c -g -w -I/app/dssrv/Ascential/DataStage/PXEngine/include -I../incl -c delcrlf.cpp -o delcrlf_tmp.o
/usr/vacpp/bin/makeC++SharedLib -p 0 -L/app/dssrv/Ascential/DataStage/PXEngine/lib orchgeneral.o orchsort.o -lorchaix3 -lorchcoreaix3 -lm delcrlf_tmp.o -o delcrlf.o ; 

6, 给makefile授权,且执行

7,新建parallel routine ,且使用,后续略




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值