Search code examples
file-handlingcaplcanoe

file handling in capl programming


please give me some hint how to perform File handling in CAPL programming. How to open and how to access the file , what and which types of functions are available for file handling.

give some suggestion regarding this topics. Thank you.


Solution

  • CAPL syntax provides you with some functions. To open a file stream for reading, use openFileRead();.

    You may use function fileGetString() to read lines from such file. A code snippet might look like

    char input[30] = "test.txt"
    int bufferLength = 256;
    char buffer[bufferLength];
    dword fh;
    
    fh = openFileRead(input,0);
    while(fileGetString(buffer,bufferLength,fh)!=0) {
        // do whatever
    }
    

    Please put some more effort next time: this is not how StackOverflow works.