📄 str_ex.c
字号:
/*
* CIN source file
*/
#include "extcode.h"
/* stubs for advanced CIN functions */
UseDefaultCINInit
UseDefaultCINDispose
UseDefaultCINAbort
UseDefaultCINLoad
UseDefaultCINUnload
UseDefaultCINSave
CIN MgErr CINRun(LStrHandle origLVstr, LStrHandle modLVstr);
CIN MgErr CINRun(LStrHandle origLVstr, LStrHandle modLVstr) {
/* An overview of the LV Manager functions and macros can be found */
/* in the "Memory Manager" chapter of the Code Interface Reference */
/* Manual. Documentation on specific LV Manager functions or macros */
/* can be found by going to "Help>>Online Reference" in LV and */
/* performing a search on the specific function name, or class of */
/* function: [Memory, Support, or File] Manager. */
#define CSTRINGLEN 10 /* arbitrary length for string */
int32 len;
char cstring[CSTRINGLEN]="";
MgErr err=bogusError; /* bogusError is miscellaneous */
/* error code defined in extcode.h */
/* write original LV string to c string only if */
/* CSTRINGLEN is large enough */
if (CSTRINGLEN >= LStrLen(*origLVstr))
SPrintf(cstring, "%H", origLVstr);
else
goto out;
/* normal c string manipulation would go here */
cstring[0]='!';
len=StrLen(cstring);
/* resize modified LV string to accomodate c string */
if (err = NumericArrayResize(uB, 1L,(UHandle *)&modLVstr, len))
goto out;
/* update the length of the modified LV string */
LStrLen(*modLVstr)=len;
/* move len bytes from cstring to modified LV string */
MoveBlock(&cstring, LStrBuf(*modLVstr), len);
return noErr;
out:
return err;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -