I have a case of needing to do the following 2 things
- To iterate over characters in *const char which is a null terminated string and check if a character exists. I want to do something like
file: *const libc::c_char;
.....
if ( file.iter().any(|i| i=='/')) {
do something.
}
- Do indexing. Check if the char at const c_char or some index into that pointer is '\0'. I am doing the following, is this the most efficient?
file: *const libc::c_char
........
((*file.offset(0)) as char) == '\0'
- Also is there a way to index into CStr object?
- Also is there a way to iterarate over CStr object?