0

g_io_channel_read_chars メソッドを使用して TCP ソケットから読み取ったデータを取得し、それを長整数に変換しようとしています。ScanLine を gchar ポインターとしてキャストせず、ScanLine[0] を使用して ScanLine の最初の変数にアクセスし、さまざまな方法で FilterAmount を宣言しているにもかかわらず、strtol、atoi を使用してみましたが、それでもその行でアプリがクラッシュします。何か案は?

static gchar ScanLine[9640];
long int FilterAmount;

g_io_channel_read_chars (source, (gchar *) ScanLine,1,&BytesRead,&GlibError);
if (BytesRead != 1){ 
    return TRUE;
} 

printf("This is my string: %s\n", ScanLine);
FilterAmount = strtol(ScanLine, NULL, 10); 

printfステートメントの出力は「2」です

4

1 に答える 1