o sorry about quzah, it was to obvious.
i added some more code to my "header" and i cant get a warning to go away, heres the file.
Code:
#include <stdio.h>
#include <string.h>
int main() {
char temp[] = "\ntesting";
char temp2[50] = { '\0' };
string2html(temp, temp2);
printf("%s", temp2);
return 0;
}
int string2html(char *data, char *dest) {
int x = 0;
while(data[x] != '\0') {
char2html(data[x], dest);
++x;
}
return 0;
}
int char2html(int data, char *dest) {
if( (data == 10 || data == 9) || (data > 31 && data < 128) ) { /* Check for valid data. */
switch(data) {
/* Escape characters. */
case '\n':
strcpy(dest, "<P>");
break;
case '\t':
strcat(dest, "     ");
break;
/* Normal ASCII. */
case ' ': /* Attemp to keed formating. */
strcat(dest, " ");
break;
case '<': /* Can cause problems. */
strcat(dest, "<");
break;
case '>': /* Can cause problems. */
strcat(dest, ">");
break;
default:
strcat(dest, data);
}
} else
return 1; /* Error. */
return data;
the "strcat(dest, data);" part in my default case gives me a warning of "[Warning] passing arg 2 of `strcat' makes pointer from integer without a cast", how can i get it to go away? how is my functions going now?
quzah, im sure your not going to like the "if( (data == 10 || data == 9) || (data > 31 && data < 128) )" part, but i dont like the idea of not attempting to check out all.