Download Pelles C here: http://www.pellesc.se
)
char *join(int ArgCount, PCTSTR Str1, ...)
{
va_list ap = {
0
};
PSTR BCX_RetStr = NULL;
PSTR currentStr = NULL;
int i;
size_t totalLen;
totalLen = strlen(Str1);
// Calc memory reqmnt
va_start(ap, Str1);
for(i=1; i<=ArgCount-1; i++)
{
currentStr = va_arg(ap,PSTR);
if(strlen(currentStr)>0) {
totalLen += (int)strlen(currentStr);
}
}
va_end(ap);
// Allocate memory
BCX_RetStr = BCX_TempStr(totalLen);
if(BCX_RetStr == 0) {
return NULL; // Not a good sign :-(
}
// Init result with Str1
strcpy(BCX_RetStr,Str1);
// Concat remainiing strings
va_start(ap, Str1);
for(i=1; i<=ArgCount-1; i++)
{
currentStr = va_arg(ap,PSTR);
if((int)strlen(currentStr)>0) {
strcat(BCX_RetStr,currentStr);
}
}
va_end(ap);
return BCX_RetStr;
}
QuoteI'll look into adding a button (no guarantees though).Thank you for taking this into consideration. As I said, it's just a small suggestion. I like consistency in software. But this is just a personal preference.
Quoteas well as now testing the new 14.5Yep, me too
.386
.model flat,stdcall
option casemap:none
ExitProcess PROTO :DWORD
printf PROTO C :DWORD,:VARARG
OutputText PROTO C :DWORD,:VARARG
ALIAS "OutputText"="printf"
includelib \PellesC\lib\Win\kernel32.lib
includelib msvcrt.lib
.data
string db 'Hello world!',0
.code
start:
invoke OutputText,ADDR string
invoke ExitProcess,0
END start012D1000 > $ 68 00202D01 PUSH CalcLen.012D2000 ; ASCII "Hello world!"
012D1005 . E8 F6EFFFFF CALL CalcLen.012D0000
012D100A . 83C4 04 ADD ESP,4
012D100D . 6A 00 PUSH 0 ; /ExitCode = 0
012D100F . E8 00000000 CALL <JMP.&KERNEL32.ExitProcess> ; \ExitProcess
012D1014 $-FF25 5C202D01 JMP DWORD PTR DS:[<&KERNEL32.ExitProcess>; kernel32.ExitProcess
012D101A .-FF25 64202D01 JMP DWORD PTR DS:[<&msvcrt.printf>] ; msvcrt.printf
QuoteRevised POASM handling of ALIAS directive (IA32, AMD64, ARM64).
printf PROTO C :DWORD,:VARARG
OutputText PROTO C :DWORD,:VARARG
ALIAS "OutputText"="printf"
Page created in 0.026 seconds with 15 queries.