Frage

I am trying to read the contents of a file as below:

    int frameFD = 0;
    int readResult;
    char buff[BUFFER_SIZE];
    frameFD = open(MY_FILE, O_RDWR);
    readResult = read(MY_FILE, buff, BUFFER_SIZE);

the BUFFER_SIZE is 256.

I am getting an error saying 'error: invalid conversion from 'const char*' to 'int' [-fpermissive]' Any solution to this issue?

War es hilfreich?

Lösung

read() uses the file descriptor, not the file name:

readResult = read(frameFD , buff, BUFFER_SIZE);

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top