Code: Select all
extern _stdcall char *PB_StringMultiply(char *String, int NbTimes)
{
char *ResultString = PB_StringBase;
int k;
if (String && *String) // It's always good for safety and perfomance to exclude null or empty strings
{
int StringLength = strlen(String);
for (k=0; k<NbTimes; k++)
{
strcpy(PB_StringBase, String);
PB_StringBase += StringLength; // Increase the output string buffer
}
}
*PB_StringBase = 0; // Finally write the zero ending string. PB_StringBase contains the result string
return ResultString; // Returns the start of the buffer, as it has been passed
}What I am trying to do is to add it to the main function
Code: Select all
int main()
{
PB_MessageBox(0, "Titre", "Text", 0);
return 0;
}Basically I got two questions:
1. Anyone knowing a good book about C, preferably online, with some nice examples on pointers and string handling?
2. Is there any special difference between a C function for use in another C source and a C function that is written for PureBasic? How would I need to call the PB_StringMultiply from C?
Thanks; I know my request is along the line "enlighten me".


