【学习】ABAP OLE 对EXCEL的处理
原文:http://blog.sina.com.cn/s/blog_7229b9c00100opx2.html
----------------------------------------------------------------------------
REPORT ZVR013.
INCLUDE OLE2INCL.
DATA: GS_EXCEL TYPE OLE2_OBJECT,
GS_WBOOKLIST TYPE OLE2_OBJECT,
GS_APPLICATION TYPE OLE2_OBJECT,
GS_WBOOK TYPE OLE2_OBJECT,
GS_ACTIVESHEET TYPE OLE2_OBJECT,
GS_SHEETS TYPE OLE2_OBJECT,
GS_NEWSHEET TYPE OLE2_OBJECT,
GS_CELL1 TYPE OLE2_OBJECT,
GS_CELL2 TYPE OLE2_OBJECT,
GS_CELLS TYPE OLE2_OBJECT,
GS_FONT TYPE OLE2_OBJECT,
GS_PAGE TYPE OLE2_OBJECT,
GS_RANGE TYPE OLE2_OBJECT,
GS_BORDERS TYPE OLE2_OBJECT.
DATA: GV_SHEET_NAME() TYPE C.
DATA: GV_OUTER_INDEX LIKE SY-INDEX.
DATA: GV_INTEX() TYPE C.
DATA: GV_LINE_CNTR TYPE I. "LINE COUNTER
DATA: GV_LINNO TYPE I. "LINE NUMBER
DATA: GV_COLNO TYPE I. "COLUMN NUMBER
DATA: GV_VALUE TYPE I. "DATA
DATA: X1 TYPE P, X2 TYPE P, Y1 TYPE P, Y2 TYPE P.
DATA: VALUE(),VALUE1().
DATA: NAME(),SIZE().
DATA: BOLD TYPE P, UNDERLINE TYPE P, ALIGNMENT TYPE P.
DATA: ROW TYPE P VALUE , LINE TYPE P VALUE . "循环次数
DATA: ROW1 TYPE P,LINE1 TYPE P.
DATA: QUANTITY(),AMOUNT().
DATA: ROWHEIGHT(),COLUMNWIDTH().
DATA: PAGE TYPE P, PG_INDEX TYPE P.
*-----------------------------------------------------------
*-----------------------------------------------------------
CREATE OBJECT GS_EXCEL 'EXCEL.APPLICATION'.
SET PROPERTY OF GS_EXCEL 'VISIBLE' = .
GET PROPERTY OF GS_EXCEL 'WORKBOOKS' = GS_WBOOKLIST.
GET PROPERTY OF GS_WBOOKLIST 'APPLICATION' = GS_APPLICATION.
SET PROPERTY OF GS_APPLICATION 'SHEETSINNEWWORKBOOK' = .
CALL METHOD OF GS_WBOOKLIST 'ADD' = GS_WBOOK.
GET PROPERTY OF GS_APPLICATION 'ACTIVESHEET' = GS_ACTIVESHEET.
SET PROPERTY OF GS_ACTIVESHEET 'NAME' = GV_SHEET_NAME.
GET PROPERTY OF GS_ACTIVESHEET 'PAGESETUP' = GS_PAGE.
SET PROPERTY OF GS_PAGE 'TOPMARGIN' = ''.
SET PROPERTY OF GS_PAGE 'BOTTOMMARGIN' = ''.
SET PROPERTY OF GS_PAGE 'LEFTMARGIN' = ''.
SET PROPERTY OF GS_PAGE 'RIGHTMARGIN' = ''. *--FORMATTING THE TITLE
FORM FORMAT USING GS_CELL1 VALUE NAME SIZE BOLD ALIGNMENT UNDERLINE.
CONDENSE VALUE.
CONDENSE NAME.
CONDENSE SIZE.
GET PROPERTY OF GS_CELL1 'FONT' = GS_FONT .
SET PROPERTY OF GS_FONT 'NAME' = NAME.
SET PROPERTY OF GS_FONT 'SIZE' = SIZE.
SET PROPERTY OF GS_FONT 'BOLD' = BOLD. "NOT BOLD
SET PROPERTY OF GS_FONT 'ITALIC' = ''. "NOT ITALIC
SET PROPERTY OF GS_FONT 'UNDERLINE' = UNDERLINE. "NOT UNDERLINED
SET PROPERTY OF GS_CELL1 'WRAPTEXT' = .
SET PROPERTY OF GS_CELL1 'HORIZONTALALIGNMENT' = ALIGNMENT.
" && 水平方向 2左对齐,3居中,4右对齐
SET PROPERTY OF GS_CELL1 'VERTICALALIGNMENT' = .
"&& 垂直方向 1靠上 ,2居中,3靠下
SET PROPERTY OF GS_CELL1 'NUMBERFORMATLOCAL' = '@'.
"&& 设置数据格式
SET PROPERTY OF GS_CELL1 'VALUE' = VALUE.
ENDFORM. "FORMAT
*------------------------------
*该函数用来合并EXCEL单元格
*------------------------------
FORM MERGED USING X1 Y1 X2 Y2.
*--SELECTING CELL AREA TO BE MERGED.
CALL METHOD OF GS_EXCEL 'CELLS' = GS_CELL1
EXPORTING
# = X1
# = Y1.
CALL METHOD OF GS_EXCEL 'CELLS' = GS_CELL2
EXPORTING
# = X2
# = Y2.
CALL METHOD OF GS_EXCEL 'RANGE' = GS_CELLS
EXPORTING
# = GS_CELL1
# = GS_CELL2.
CALL METHOD OF GS_CELLS 'SELECT'.
*--MERGING
CALL METHOD OF GS_CELLS 'MERGE' .
ENDFORM. "MERGED
*---------------------------------
*生成四周有边框的单元格
*---------------------------------
FORM MERGED_BORDERS USING X1 Y1 X2 Y2.
*--SELECTING CELL AREA TO BE MERGED.
CALL METHOD OF GS_EXCEL 'CELLS' = GS_CELL1
EXPORTING
# = X1
# = Y1.
CALL METHOD OF GS_EXCEL 'CELLS' = GS_CELL2
EXPORTING
# = X2
# = Y2.
CALL METHOD OF GS_EXCEL 'RANGE' = GS_CELLS
EXPORTING
# = GS_CELL1
# = GS_CELL2.
CALL METHOD OF GS_CELLS 'SELECT'.
*--MERGING
CALL METHOD OF GS_CELLS 'MERGE' .
GET PROPERTY OF GS_CELLS 'BORDERS' = GS_RANGE .
SET PROPERTY OF GS_RANGE 'WEIGHT' = ''.
SET PROPERTY OF GS_RANGE 'LINESTYLE' = ''.
FREE OBJECT GS_RANGE.
ENDFORM. "MERGED
*--------------------------------------
*---------------------------------
*生成左右有边框的单元格
*---------------------------------
FORM SIDES_BORDERS USING X1 Y1 X2 Y2.
*--SELECTING CELL AREA TO BE MERGED.
CALL METHOD OF GS_EXCEL 'CELLS' = GS_CELL1
EXPORTING
# = X1
# = Y1.
CALL METHOD OF GS_EXCEL 'CELLS' = GS_CELL2
EXPORTING
# = X2
# = Y2.
CALL METHOD OF GS_EXCEL 'RANGE' = GS_CELLS
EXPORTING
# = GS_CELL1
# = GS_CELL2.
CALL METHOD OF GS_CELLS 'SELECT'.
*--MERGING
CALL METHOD OF GS_CELLS 'MERGE' .
CALL METHOD OF GS_CELLS 'BORDERS' = GS_BORDERS
EXPORTING
# = ''.
SET PROPERTY OF GS_BORDERS 'LINESTYLE' = ''.
SET PROPERTY OF GS_BORDERS 'WEIGHT' = .
FREE OBJECT GS_BORDERS. CALL METHOD OF GS_CELLS 'BORDERS' = GS_BORDERS
EXPORTING
# = ''.
SET PROPERTY OF GS_BORDERS 'LINESTYLE' = ''.
*& (其中BORDERS参数:1-左、2-右、3-顶、4-底、5-斜、6-斜/; *&LINESTYLE值:1与7-细实、2-细虚、4-点虚、9-双细实线) SET PROPERTY OF GS_BORDERS 'WEIGHT' = .
FREE OBJECT GS_BORDERS.
ENDFORM. "MERGED
*---------------------------------
FORM LEFT_BORDERS USING X1 Y1 X2 Y2.
*--SELECTING CELL AREA TO BE MERGED.
CALL METHOD OF GS_EXCEL 'CELLS' = GS_CELL1
EXPORTING
# = X1
# = Y1.
CALL METHOD OF GS_EXCEL 'CELLS' = GS_CELL2
EXPORTING
# = X2
# = Y2.
CALL METHOD OF GS_EXCEL 'RANGE' = GS_CELLS
EXPORTING
# = GS_CELL1
# = GS_CELL2.
CALL METHOD OF GS_CELLS 'SELECT'.
*--MERGING
CALL METHOD OF GS_CELLS 'MERGE' .
CALL METHOD OF GS_CELLS 'BORDERS' = GS_BORDERS
EXPORTING
# = ''.
SET PROPERTY OF GS_BORDERS 'LINESTYLE' = ''.
SET PROPERTY OF GS_BORDERS 'WEIGHT' = .
FREE OBJECT GS_BORDERS.
ENDFORM. "MERGED
FORM RIGHT_BORDERS USING X1 Y1 X2 Y2.
*--SELECTING CELL AREA TO BE MERGED.
CALL METHOD OF GS_EXCEL 'CELLS' = GS_CELL1
EXPORTING
# = X1
# = Y1.
CALL METHOD OF GS_EXCEL 'CELLS' = GS_CELL2
EXPORTING
# = X2
# = Y2.
CALL METHOD OF GS_EXCEL 'RANGE' = GS_CELLS
EXPORTING
# = GS_CELL1
# = GS_CELL2.
CALL METHOD OF GS_CELLS 'SELECT'.
*--MERGING
CALL METHOD OF GS_CELLS 'MERGE' .
CALL METHOD OF GS_CELLS 'BORDERS' = GS_BORDERS
EXPORTING
# = ''.
SET PROPERTY OF GS_BORDERS 'LINESTYLE' = ''.
SET PROPERTY OF GS_BORDERS 'WEIGHT' = .
FREE OBJECT GS_BORDERS.
ENDFORM. "MERGED *---------------------------------
*生成BOTTOM有边框的单元格
*---------------------------------
FORM BOTTOM_BORDERS USING X1 Y1 X2 Y2.
*--SELECTING CELL AREA TO BE MERGED.
CALL METHOD OF GS_EXCEL 'CELLS' = GS_CELL1
EXPORTING
# = X1
# = Y1.
CALL METHOD OF GS_EXCEL 'CELLS' = GS_CELL2
EXPORTING
# = X2
# = Y2.
CALL METHOD OF GS_EXCEL 'RANGE' = GS_CELLS
EXPORTING
# = GS_CELL1
# = GS_CELL2.
CALL METHOD OF GS_CELLS 'SELECT'.
*--MERGING
CALL METHOD OF GS_CELLS 'MERGE' .
CALL METHOD OF GS_CELLS 'BORDERS' = GS_BORDERS
EXPORTING
# = ''.
SET PROPERTY OF GS_BORDERS 'LINESTYLE' = ''.
SET PROPERTY OF GS_BORDERS 'WEIGHT' = .
FREE OBJECT GS_BORDERS.
ENDFORM. "MERGED FORM BOTTOM_LINES USING X1 Y1 X2 Y2.
*--SELECTING CELL AREA TO BE MERGED.
CALL METHOD OF GS_EXCEL 'CELLS' = GS_CELL1
EXPORTING
# = X1
# = Y1.
CALL METHOD OF GS_EXCEL 'CELLS' = GS_CELL2
EXPORTING
# = X2
# = Y2.
CALL METHOD OF GS_EXCEL 'RANGE' = GS_CELLS
EXPORTING
# = GS_CELL1
# = GS_CELL2.
CALL METHOD OF GS_CELLS 'SELECT'.
*--MERGING
CALL METHOD OF GS_CELLS 'MERGE' .
CALL METHOD OF GS_CELLS 'BORDERS' = GS_BORDERS
EXPORTING
# = ''.
SET PROPERTY OF GS_BORDERS 'LINESTYLE' = ''.
SET PROPERTY OF GS_BORDERS 'WEIGHT' = .
FREE OBJECT GS_BORDERS.
ENDFORM. "MERGED *-------------------------------------------------
*设置行高和列宽。
FORM ROW_COLUMN USING X1 Y1 X2 Y2 ROWHEIGHT COLUMNWIDTH.
*--SELECTING CELL AREA TO BE MERGED.
CALL METHOD OF GS_EXCEL 'CELLS' = GS_CELL1
EXPORTING
# = X1
# = Y1.
CALL METHOD OF GS_EXCEL 'CELLS' = GS_CELL2
EXPORTING
# = X2
# = Y2.
CALL METHOD OF GS_EXCEL 'RANGE' = GS_CELLS
EXPORTING
# = GS_CELL1
# = GS_CELL2.
CALL METHOD OF GS_CELLS 'SELECT'.
*--MERGING
CALL METHOD OF GS_CELLS 'MERGE' .
GET PROPERTY OF GS_CELLS 'ROWS' = GS_BORDERS.
SET PROPERTY OF GS_BORDERS 'ROWHEIGHT' = ROWHEIGHT.
GET PROPERTY OF GS_CELLS 'COLUMNS' = GS_RANGE .
SET PROPERTY OF GS_RANGE 'COLUMNWIDTH' = COLUMNWIDTH.
FREE OBJECT GS_BORDERS.
FREE OBJECT GS_RANGE.
ENDFORM. "MERGED
FORM ROWHEIGHT USING X1 Y1 X2 Y2 ROWHEIGHT.
*--SELECTING CELL AREA TO BE MERGED.
CALL METHOD OF GS_EXCEL 'CELLS' = GS_CELL1
EXPORTING
# = X1
# = Y1.
CALL METHOD OF GS_EXCEL 'CELLS' = GS_CELL2
EXPORTING
# = X2
# = Y2.
CALL METHOD OF GS_EXCEL 'RANGE' = GS_CELLS
EXPORTING
# = GS_CELL1
# = GS_CELL2.
CALL METHOD OF GS_CELLS 'SELECT'.
*--MERGING
CALL METHOD OF GS_CELLS 'MERGE' .
GET PROPERTY OF GS_CELLS 'ROWS' = GS_BORDERS.
SET PROPERTY OF GS_BORDERS 'ROWHEIGHT' = ROWHEIGHT.
* GET PROPERTY OF GS_CELLS 'COLUMNS' = GS_RANGE .
* SET PROPERTY OF GS_RANGE 'COLUMNWIDTH' = COLUMNWIDTH.
FREE OBJECT GS_BORDERS.
FREE OBJECT GS_RANGE.
ENDFORM. "MERGED FORM COLUMNWIDTH USING X1 Y1 X2 Y2 COLUMNWIDTH.
*--SELECTING CELL AREA TO BE MERGED.
CALL METHOD OF GS_EXCEL 'CELLS' = GS_CELL1
EXPORTING
# = X1
# = Y1.
CALL METHOD OF GS_EXCEL 'CELLS' = GS_CELL2
EXPORTING
# = X2
# = Y2.
CALL METHOD OF GS_EXCEL 'RANGE' = GS_CELLS
EXPORTING
# = GS_CELL1
# = GS_CELL2.
CALL METHOD OF GS_CELLS 'SELECT'.
*--MERGING
CALL METHOD OF GS_CELLS 'MERGE' .
* GET PROPERTY OF GS_CELLS 'ROWS' = GS_BORDERS.
* SET PROPERTY OF GS_BORDERS 'ROWHEIGHT' = ROWHEIGHT.
GET PROPERTY OF GS_CELLS 'COLUMNS' = GS_RANGE .
SET PROPERTY OF GS_RANGE 'COLUMNWIDTH' = COLUMNWIDTH.
FREE OBJECT GS_BORDERS.
FREE OBJECT GS_RANGE.
ENDFORM. "MERGED
********************************************************
FORM PAGES USING L_FILE X Y.
X1 = .
Y1 = .
X2 = X.
Y2 = Y.
*DO PAGE TIMES.
*_-CREATE EXCEL
CONCATENATE 'SHEET' '' INTO GV_SHEET_NAME.
CREATE OBJECT GS_EXCEL 'EXCEL.APPLICATION'.
SET PROPERTY OF GS_EXCEL 'VISIBLE' = .
GET PROPERTY OF GS_EXCEL 'WORKBOOKS' = GS_WBOOKLIST.
*----COPY
CALL METHOD OF GS_WBOOKLIST 'OPEN' = GS_RANGE
EXPORTING
# = L_FILE.
CALL METHOD OF GS_EXCEL 'WORKSHEETS' = GS_BORDERS
EXPORTING # = .
CALL METHOD OF GS_BORDERS 'ACTIVATE'.
CALL METHOD OF GS_EXCEL 'CELLS' = GS_CELL1
EXPORTING
# =
# = .
CALL METHOD OF GS_EXCEL 'CELLS' = GS_CELL2
EXPORTING
# = X
# = Y.
CALL METHOD OF GS_EXCEL 'RANGE' = GS_CELLS
EXPORTING
# = GS_CELL1
# = GS_CELL2.
CALL METHOD OF GS_CELLS 'COPY'.
*----PASTESPECIAL
*-CREATE
CALL METHOD OF GS_WBOOKLIST 'ADD' = GS_WBOOK.
GET PROPERTY OF GS_APPLICATION 'ACTIVESHEET' = GS_ACTIVESHEET.
SET PROPERTY OF GS_ACTIVESHEET 'NAME' = GV_SHEET_NAME.
CALL METHOD OF GS_EXCEL 'CELLS' = GS_CELL1
EXPORTING
# =
# = .
CALL METHOD OF GS_EXCEL 'CELLS' = GS_CELL2
EXPORTING
# = X
# = Y.
CALL METHOD OF GS_EXCEL 'RANGE' = GS_CELLS
EXPORTING
# = GS_CELL1
# = GS_CELL2.
CALL METHOD OF GS_CELLS 'PASTESPECIAL'.
CALL METHOD OF GS_CELLS 'COPY'.
CALL METHOD OF GS_RANGE 'ACTIVATE'.
CALL METHOD OF GS_RANGE 'CLOSE'.
CALL METHOD OF GS_ACTIVESHEET 'ACTIVATE'.
ENDFORM.
*-------------------------------------------------
FORM PAGES1 USING X Y.
DO PAGE TIMES.
X1 = X1 + X.
Y1 = .
X2 = X2 + X.
Y2 = Y.
CALL METHOD OF GS_EXCEL 'CELLS' = GS_CELL1
EXPORTING
# =
# = .
CALL METHOD OF GS_EXCEL 'CELLS' = GS_CELL2
EXPORTING
# = X
# = Y.
CALL METHOD OF GS_EXCEL 'RANGE' = GS_CELLS
EXPORTING
# = GS_CELL1
# = GS_CELL2.
CALL METHOD OF GS_CELLS 'COPY'.
CALL METHOD OF GS_EXCEL 'CELLS' = GS_CELL1
EXPORTING
# = X1
# = Y1.
CALL METHOD OF GS_EXCEL 'CELLS' = GS_CELL2
EXPORTING
# = X2
# = Y2.
CALL METHOD OF GS_EXCEL 'RANGE' = GS_CELLS
EXPORTING
# = GS_CELL1
# = GS_CELL2.
CALL METHOD OF GS_CELLS 'PASTESPECIAL'.
ENDDO.
ENDFORM.
if p_file is initial.
message '请输入导入文件的路径' type 'I'.
leave to transaction sy-tcode.
endif.
data: begin of i_excel occurs 0.
* ROW(4) TYPE N,
* COL(4) TYPE N,
* VALUE(150),
include structure alsmex_tabline.
data: end of i_excel.
data: l_answer(1) type c.
data: l_column type i.
field-symbols: <fs>.
data: l_pathname like rlgrap-filename.
data:
c_begin_row type i value 4, "Beginning row of excel file
c_begin_col type i value 2, "Beginning column of excel file
c_end_row type i value 10000, "Ending row of excel file
c_end_col type i value 11. "Ending column of excel file
move p_file to l_pathname.
call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'
exporting
filename = l_pathname
i_begin_col = c_begin_col
i_begin_row = c_begin_row
i_end_col = c_end_col
i_end_row = c_end_row
tables
intern = i_excel
exceptions
inconsistent_parameters = 1
upload_ole = 2
others = 3.
【学习】ABAP OLE 对EXCEL的处理的更多相关文章
- 2018年,请不要再使用OLE生成EXCEL文件
输出EXCEL文件是ABAP开发工作中的常见需求,为了学习相关技术,我翻译过一篇文章:使用OLE2对象创建EXCEL文件,并且一度乐在其中. 最近几个月,经过与若干EXCEL打印程序的艰苦斗争,以及对 ...
- 【ABAP系列】SAP ABAP DOI展示EXCEL或WORD
公众号:SAP Technical 本文作者:matinal 原文出处:http://www.cnblogs.com/SAPmatinal/ 原文链接:[ABAP系列]SAP ABAP DOI展示EX ...
- 一步步实现ABAP后台导入EXCEL到数据库【3】
在一步步实现ABAP后台导入EXCEL到数据库[2]里,我们已经实现计划后台作业将数据导入数据库的功能.但是,这只是针对一个简单的自定义结构的导入程序.在实践应用中,面对不同的表.不同的导入文件,我们 ...
- 一步步实现ABAP后台导入EXCEL到数据库【1】
在SAP的应用当中,导入.导出EXCEL文件的情况是一个常见的需求,有时候用户需要将大量数据定期导入到SAP的数据库中.这种情况下,使用导入程序在前台导入可能要花费不少的时间,如果能安排导入程序为后台 ...
- OLE操作Excel编译错误处理
Excel在公司用的很多,而这个东西我用的不是很好,就想用程序来处理,遇到很多错误.这几天研究了下OLE操作Excel.环境:VS2008 SP1+Excel 2007 加入OLE Type Li ...
- (原创)带模板的OLE输出EXCEL
其实带模板的OLE输出EXCEL就是将要输出的EXCEL中一些拥有固定值(如标题,表头行等)的单元格先填充好数据和设置好格式后作为模板上传到SAP 中.这样后续在输出EXCEL时只需从SAP中将模板下 ...
- ABAP OLE
OLE DATA: excel TYPE ole2_object, workbook TYPE ole2_object, sheet TYPE ole2_object, cell TYPE ole2_ ...
- ABAP,学习不一样的EXCEL导出----XLSX Workbench
这个工具是在查找ABAP导出EXCEL资料的时候发现,是国外的一位大牛自己开发的开源项目,体验了一番,确实很好用. 工具特点: No ABAP Programming Skills are requi ...
- ABAP ole方式对EXCEL进行操作
DATA: excel TYPE ole2_object, workbook TYPE ole2_object, sheet TYPE ole2_object, ...
随机推荐
- 10分钟进阶Nuget
nuget是什么 .net版的maven(java)? 如果你用过windows的chocolatey,mac的homebrew或许更容易理解他,先来回顾下以前我们是如何处理或者碰到过的问题. 1.假 ...
- 转载的在DOS下操作mysql
转载原文地址:http://www.server110.com/mysql/201309/1070.html 一.连接MYSQL. 格式: mysql -h主机地址 -u用户名 -p用户密码 1.例1 ...
- Ubuntu的关机重启命令知识
Ubuntu的关机重启命令知识,以作备忘. 重启命令: 1.reboot 2.shutdown -r now 立刻重启(root用户使用) 3.shutdown -r 10 过10分钟自动重启(roo ...
- Java 单链表的倒置
在面试,笔试的过程中经常会遇到面试官问这种问题,实现单链表的倒置方法.现在对单链表的倒置犯法做个记录,方便自己以后查看. 单链表的定义: public class Node { int v; Node ...
- 2016031601 - 刻录ubuntu的U盘启动盘
使用UltraISO来刻录ubuntu15.1的系统安装盘. 需要U盘1个,ubuntu15.1系统镜像文件. 具体步骤如下: a.安装UltraISO软件,具体软件安装. b.安装完成后进行系统刻录 ...
- Navigation bar 的注意事项
Navigation bar 的注意事项 Bar button item 使用 button 作为 custom view,初始化 isEnabled 为 false,注意顺序 需要设置 bar bu ...
- 意犹未尽而来的第一篇Android 逆向
游戏:咕噜王国大冒险 平台:android 目标: 1. 去除乱七八糟提示(本篇目标) 2. 去除google弹窗 3. 破解“all stages” 破文开始: 1. 使用APKIDE反编译:搜索字 ...
- uva 1335 - Beijing Guards
竟然用二分,真是想不到: 偶数的情况很容易想到:不过奇数的就难了: 奇数的情况下,一个从后向前拿,一个从前向后拿的分配方法实在太妙了! 注: 白书上的代码有一点点错误 代码: #include< ...
- webkit javascript
http://www.infoq.com/cn/news/2013/02/douglas-interview http://blog.csdn.net/horkychen/article/detail ...
- [转贴]从零开始学C++之异常(一):C语言错误处理方法、C++异常处理方法(throw, try, catch)简介
一.C语言错误处理方法 1.返回值(if … else语句判断错误) 2.errno(linux 系统调用) 3.goto语句(函数内局部跳转) 4.setjmp.longjmp(Do not use ...