| 110 | } |
| 111 | |
| 112 | char* update() { |
| 113 | if (!m_szPath) { |
| 114 | return NULL; |
| 115 | } |
| 116 | |
| 117 | if (!fd) { |
| 118 | fd = open(m_szPath, O_RDONLY); |
| 119 | } else { |
| 120 | lseek(fd, 0, SEEK_SET); |
| 121 | } |
| 122 | |
| 123 | if (fd < 0) { |
| 124 | fd = 0; |
| 125 | return NULL; |
| 126 | } |
| 127 | |
| 128 | int ret = read(fd, line, MAX_LEN); |
| 129 | if (ret <= 0) { |
| 130 | close(fd); |
| 131 | fd = 0; |
| 132 | } |
| 133 | line[ret] = '\0'; |
| 134 | return line; |
| 135 | } |
| 136 | |
| 137 | int64_t getValue(uint32_t index) { |
| 138 | char *ptr = line; |