首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >专栏 >短信分割

短信分割

作者头像
WindCoder
发布2018-09-20 16:05:42
发布2018-09-20 16:05:42
12.1K0
举报
文章被收录于专栏:WindCoderWindCoder

/* 功能:短信分割 日期:2013-05-28 */ #include<stdio.h> #include<stdlib.h> #include<string.h> #define LEN 70 #define userLEN 1000 int main(void) { char message[userLEN]={0}; char **p; int i,j,row;

printf("Please input your short message:n"); gets(message); //格式转换 row = strlen(message) / 70 + 1; p = (char**)malloc(row*4);

for (i=0;i<row;i++) {

p[i] = (char*)malloc(70*sizeof(char));

} for(i=0;i<row;i++) {

for(j=0;j<LEN;j++) { p[i][j] = message[i * 70 + j]; }

} //分割并输出短信 printf("send:n");

for (i=0;i<row;i++) { printf("%d.",i+1); for (j=0;j<LEN;j++) { printf("%c",p[i][j]); }

printf("n"); } //动态数组释放 for(i = 0;i<row;i++) { free(p[i]); } free(p);

system("pause"); return 0;

}

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2013-10-26,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档