Hallo
Ich will die Funktion strncat verwenden um einen String an das Ende
eines weiteren Strings dranzuhängen.
Wenn ich die Funktion so verwende:
1 | char package_source[25];
|
2 | char package_minutes[3];
|
3 | char package_seconds[3];
|
4 | ...
|
5 | //Nur Testwerte
|
6 | U_INT8 minutes = 30;
|
7 | U_INT8 seconds = 54;
|
8 |
|
9 | //Convert the integer values to ASCII code
|
10 | itoa(minutes ,package_minutes ,10);
|
11 | itoa(seconds ,package_seconds ,10);
|
12 |
|
13 | //Copy the parts of the package to the end of the source package
|
14 | strncat(package_source,3,package_minutes );
|
15 | strncat(package_source,3,package_seconds );
|
...dann bekomme ich jedesmal wenn ich strncat() verwende die Warnung:
------------------------------
warning: passing argument 2 of 'strncat' makes pointer from integer
without a cast
------------------------------
Was hat es damit auf sich? Argument 2 von strcat() ist doch bloß die
Anzahl der Zeichen, die kopiert werden sollen. Was soll ich da casten?