Misc. functions (1).
By SalimMeghani
- 212 reads
// Workout current column lettering dependant on integer column.
void current_column(char *fch, char *sch, int column)
{
div_t x;
if (column<=26)
{
*fch=96+column;
*sch=32;
}
else
{
x=div(column,26);
if(x.rem)
{
*sch=x.rem+96;
*fch=x.quot+96;
}
else
{
*sch=x.rem+122;
*fch=(x.quot-1)+96;
}
}
}
void cleanup(char *output, char *input)
{
int loop=0, yloop=0;
for (loop=0;loop<=strlen(input);loop++)
{
if (input[loop]!='Ç')
{
output[yloop]=input[loop];
yloop++;
}
}
}
// Clear the contents of a string.
void clr_str(char *s)
{
int loop;
for (loop=0; loop<=strlen(s)-1;loop++)
s[loop]=' ';
}
// Find an operator's string position.
int find_optr(int start, char *form)
{
while(form[start]!='*' && form[start]!='+' && form[start]!='/' && form[start]!='-' && form[start]!='#' && form[start]!=')')
start++;
return(start);
}
- Log in to post comments