3

以下のコードの出力バッファー (文字配列) を、さらに計算するために浮動小数点形式に変換しようとしています。誰もそれを行う方法を教えてもらえますか。

#include "usbtmc.h"
#include <errno.h>
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
#include <getopt.h>
#include <inttypes.h>
#include <sys/types.h>
#include <pthread.h>

int main() 
{

    int myfile;
    char buffer[4000];

    int actual;

    myfile=open("/dev/usbtmc1",O_RDWR);
    if(myfile>0)
    {
        system("echo MEAS:VOLT:AC?>/dev/usbtmc1");
        actual=read(myfile,buffer,4000);

        buffer[actual] = 0;
        printf("Response = \n %s\n",buffer);

        close(myfile);
    }


    return 0;
}

このコードの出力例は次のとおりです。

応答 = +1.29273072E-04

4

1 に答える 1