how to do this ?

  • hello


    can some one help please


    how to use a certain line in a certain file ?


    I mean:


    if I do this in enigma_main.cpp

    Code
    ASSIGN(something, eLabel, "something");


    then I want this "something" to be a certain line in a certain file


    I do


    Code
    something->setText(WHAT I WRITE HERE?)


    thanks

  • hi, you must open the file with fopen function and read the lines with fgets function.


    fopen
    Syntax:


    #include <stdio.h>
    FILE *fopen( const char *fname, const char *mode );


    The fopen() function opens a file indicated by fname and returns a stream associated with that file. If there is an error, fopen() returns NULL. mode is used to determine how the file will be treated (i.e. for input, output, etc)


    fgets
    Syntax:


    #include <stdio.h>
    char *fgets( char *str, int num, FILE *stream );


    The function fgets() reads up to num - 1 characters from the given file stream and dumps them into str. The string that fgets() produces is always NULL-terminated.

    PHP
    fgets() will stop when it reaches the end of a line, in which case str will contain that newline character.

    Otherwise, fgets() will stop when it reaches num - 1 characters or encounters the EOF character. fgets() returns str on success, and NULL on an error.


    If the wanted line is in a fixed order (number of line) recall fgets till you have your string, or
    search for something with other string functions.............