unsigned char* 配列をファイルに書き込もうとしています。
これまでに試したコードの最小限の動作例は次のとおりです (fp が正しく初期化されていると仮定します)。
unsigned char* x; int i; int j; int sizeOfx;
for (i=0; i<n; i++) {
x = // getter function with parameter i
sizeOfx = // getter function that returns the number of elements in x
for (j=0; j<sizeOfx; j++) {
fprintf(fp,"%s",x[j]);
}
}
つまり、一度に 1 要素ずつ char 配列を調べて、それをファイルに書き込んでいます。
ただし、エラーが発生します
format ‘%s’ expects argument of type ‘char*’, but argument 3 has type ‘int’ [-Wformat]
どうすればこれを修正できますか?
事前にどうもありがとうございました!