| 281 | } |
| 282 | |
| 283 | int readYAML(char **ymlContent) { |
| 284 | std::ifstream is("conf/flowServer.yml", std::ifstream::binary); |
| 285 | if (is) { |
| 286 | // get length of file: |
| 287 | is.seekg(0, is.end); |
| 288 | int length = is.tellg(); |
| 289 | is.seekg(0, is.beg); |
| 290 | |
| 291 | char * buffer = new char[length]; |
| 292 | |
| 293 | printf("Reading %s len %d\n", "conf/flowServer.yml", length); |
| 294 | // read data as a block: |
| 295 | is.read(buffer, length); |
| 296 | |
| 297 | is.close(); |
| 298 | |
| 299 | // ...buffer contains the entire file... |
| 300 | *ymlContent = buffer; |
| 301 | |
| 302 | return length; |
| 303 | } |
| 304 | return 0; |
| 305 | } |
| 306 | |
| 307 | static int sockfd = 0, newsockfd = 0; |
| 308 | void sigHandler(int signal) { |