Search Results

Search found 2 results on 1 pages for 'zuhakasa'.

Page 1/1 | 1 

  • Using sscanf for the dynamic delimiters (inputted by users) in parsing an input string in C? [migrated]

    - by Zuhakasa
    I'm encountering a problem in parsing a string using sscanf() function. My function gets 2 string parameters. One for input string and another one for a dynamic list of delimiters. How can I use sscanf to parse the input string with the defined delimiters inputted by users. For example: Myfunction(char * input_string, char * delimiter_list){ scanf("%s", input_string); scanf("%s", delimiter_list); sscanf(input_string, ???...); ................ }

    Read the article

  • How to keep the first result of a function from Prolog?

    - by zuhakasa
    I need to write a customized function that will be called many times by other fixed functions. In this function, at the first called time, it will return the total number of lines of a file. The second called time of this function, forward, will return the number of lines in small sections of this file. My question is how I keep the first returned result(total number of lines of a file) and use it for the next called times of my function. I need to write or declare any thing only in this function(not in the caller). Something like this: myFunction(Input, MyResult, FirstResult) :- calculateInputFunction(Input, Result), !, MyResult is Result, ... . The problem is, every time myFunction is called, it receives different Input and returns different MyResult. But I would like to keep the first MyResult to use for next called times of myFunction. How can I do that? Thanks very much for your answer in advance.

    Read the article

1