octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #57879] strncmp(str_a, str_b, N) gives an erro


From: Utkarsh Dhandhania
Subject: [Octave-bug-tracker] [bug #57879] strncmp(str_a, str_b, N) gives an error for N=0
Date: Fri, 21 Feb 2020 18:44:27 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:73.0) Gecko/20100101 Firefox/73.0

URL:
  <https://savannah.gnu.org/bugs/?57879>

                 Summary: strncmp(str_a, str_b, N) gives an error for N=0
                 Project: GNU Octave
            Submitted by: yoodee
            Submitted on: Fri 21 Feb 2020 11:44:25 PM UTC
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Unexpected Error
                  Status: None
             Assigned to: None
         Originator Name: Utkarsh Dhandhania
        Originator Email: 
             Open/Closed: Open
                 Release: dev
         Discussion Lock: Any
        Operating System: Any

    _______________________________________________________

Details:

strncmp(str_a, str_b, N) function basically takes 2 strings and a number N and
compares the 2 strings up to first N characters. If the first N characters are
equal in both strings, the function returns 1, otherwise 0.


Command - 

strncmp("abc","def",0)



Output - 
error: strncmp: N must be greater than 0

In this example, MATLAB returns 1, which seems reasonable

Same unexpected error in case of the ignore-case version of this function -
strncmpi





    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?57879>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]