I'm using this source code I found online in an attempt to convert ASCII strings in to 7 bit PDU arrays. When compiled I get the following error.
In function 'int convert_ascii_to_7bit(char*, char**)':
error: invalid operands of types 'int' and 'char**' to binary 'operator*' In function 'int ascii_to_pdu(char*, unsigned char**)':
Does anyone have an idea of what might be wrong?
/***************************************************************************
*
* Functions for converting between an ISO-8859-1 ASCII string and a
* PDU-coded string as described in ETSI GSM 03.38 and ETSI GSM 03.40.
*
* This code is released to the public domain in 2003 by Mats Engstrom,
* Nerdlabs Consulting. ( matseng at nerdlabs dot org )
*
**************************************************************************/
/*
* Use a lookup table to convert from an ISO-8859-1 string to
* the 7-bit default alphabet used by SMS.
*
* *scii The string to convert
*
* **a7bit A pointer to the array that the result is stored in,
* the space is malloced by this function
*
* Returns the length of the a7bit-array
*
* Note: The a7bit-array must be free()'ed by te caller
*/
static int convert_ascii_to_7bit(char *ascii, char **a7bit) {
int r;
int w;
int len;
r=0;
w=0;
/* Allocate sufficient memory for the result string */
len = strlen(ascii)*2+1
*a7bit=malloc(len);
while (ascii[r]!=0) {
if ((lookup_ascii8to7[(unsigned char)ascii[r]])<256) {
(*a7bit)[w++]=abs(lookup_ascii8to7[(unsigned char)ascii[r++]]);
} else {
(*a7bit)[w++]=27;
(*a7bit)[w++]=lookup_ascii8to7[(unsigned char)ascii[r++]]-256;
}
}
/* Realloc the result array to the correct size */
*a7bit=realloc(*a7bit,w);
return w;
}