Pointer arithmetic
Signed-off-by: tyrolyean <tyrolyean@tyrolyean.net>
This commit is contained in:
parent
9d7f1a1779
commit
09f4d8d360
1 changed files with 3 additions and 3 deletions
|
@ -214,13 +214,13 @@ const char* get_next_line(const char* message, size_t len){
|
|||
* the left.
|
||||
*/
|
||||
const char* get_prev_line(const char* message, size_t len_neg){
|
||||
for(size_t i = 0; i < len_neg-2; i++){
|
||||
for(size_t i = 0; i < (len_neg-2); i++){
|
||||
if(message[-i] == '\n'){
|
||||
if(message[-(i+1)] == '\r'){
|
||||
return &message[-(i+2)];
|
||||
return message-(i+2);
|
||||
|
||||
}else{
|
||||
return &message[-(i+2)];
|
||||
return message-(i+1);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue