Welcome! Log In Create A New Profile

Advanced

Module to check if file contains a character

alexander_koch_log
March 16, 2013 11:16AM
Hello,

Without reading the whole file, what is the best approach to only check
if the beginning of the file contains a specific character?

Would something like this be the right approach?

b = ngx_pcalloc(r->pool, sizeof(ngx_buf_t));
b->file = ngx_pcalloc(r->pool, sizeof(ngx_file_t));

then set file_pos, file_last etc.

and later do ngx_cpymem(s, b->pos, size) to copy it in a u_char and then
do a if s[0] == ?

Thanks,

Alex

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Module to check if file contains a character

alexander_koch_log March 16, 2013 11:16AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 294
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready