how to detect a particular string in a file using C program

前端 未结 3 637
温柔的废话
温柔的废话 2021-01-28 15:40

I have a file and I want to read this file using C program using file operations. Then i want to take parameters from that file. Lets say nalu_type=x. So whenever i detect the s

3条回答
  •  攒了一身酷
    2021-01-28 16:43

    This sounds a bit like homework but here's a basic strategy that should help.

    You basically just want to parse the file as text. Iteratively find the index of string "nalu_type=" and then get a substring of what comes after that. The part you are missing is what delimits the value x. You would need to know what the end-delimiter is at least.

提交回复
热议问题