09-26-2013
Calling a member function "const" is to guarantee to the compiler "this function modifies absolutely nothing in this class". You are calling a non-const member function(strlen) from a const member function, hence the error.
Which is to say, if you made your strlen() member const too, the error should stop.
'retstring' should be returning 'const char *'.
I'm not sure why you bothered making strlen() when you could have just #include <stdio.h>.
Last edited by Corona688; 09-26-2013 at 01:19 PM..
These 2 Users Gave Thanks to Corona688 For This Post:
8 More Discussions You Might Find Interesting
1. Programming
Can anybody tell me what is the best website or books to read for getting good knowledge in doing C++ class design. Please leave cplusplus.com or bjorne stroustrup. Other than these is there any website or book. Please do tell me (0 Replies)
Discussion started by: dhanamurthy
0 Replies
2. Programming
Hi, i have a question about C++. Is it possible to declare a class with a member ot the same class? For example, a linked list or i want to convert this C code to C++ class (Elemento)
typedef struct elemento
{
char name;
char value;
List<struct elemento> ltElementos;
... (7 Replies)
Discussion started by: pogdorica
7 Replies
3. Shell Programming and Scripting
I have a requirement where I collect inputs from entry widget in gui(via variables a,b,c) and then output a string like this: -a a -b b -c c.
Hence if I have given a=1 b=2 c=3, The output string is --> -a 1 -b 2 -c 3
or if I have given a=1 b=2 (c left blank) then the output is --> -a 1... (1 Reply)
Discussion started by: animesharma
1 Replies
4. Shell Programming and Scripting
I've notepad in which logs are present. I need to design a web page by which if some one paste their ticket number and click on "search" the logs for that ticket number should be displayed at the bottom.
I need some advice on how to do this and which is the right platform to do this.
Regards... (1 Reply)
Discussion started by: ilugopal
1 Replies
5. UNIX for Advanced & Expert Users
Hi all!
I am trying to register a device in an existing device class, but I am
having trouble getting the pointer to an existing class.
I can create a class in a module, get the pointer to it and then use
it to register the device with:
*cl = class_create(THIS_MODULE, className);... (0 Replies)
Discussion started by: hdaniel@ualg.pt
0 Replies
6. Programming
I have the two class definition as follows.
class A { public: int a; };
class B : virtual public A{ };
The size of class A is shown as 4, and size of class B is shown as 16. Why is this effect ?. (2 Replies)
Discussion started by: techmonk
2 Replies
7. Shell Programming and Scripting
Hello,
I want to check whether string has only numeric characters. The following code doesn't work for me
#!/usr/local/bin/bash
if ]]; then
echo "true"
else
echo "False"
fi
# ./yyy '346'
False
# ./yyy 'aaa'
False
I'm searching for solution using character classes, not regex.... (5 Replies)
Discussion started by: urello
5 Replies
8. Programming
Hello All,
I am a learner in C++. I was testing my inheritance knowledge with following piece of code.
#include <iostream>
using namespace std;
class base
{
public :
void display()
{
cout << "In base display()" << endl;
}
void display(int k)
{... (2 Replies)
Discussion started by: anand.shah
2 Replies
LEARN ABOUT OSX
bsearch_b
BSEARCH(3) BSD Library Functions Manual BSEARCH(3)
NAME
bsearch, bsearch_b -- binary search of a sorted table
SYNOPSIS
#include <stdlib.h>
void *
bsearch(const void *key, const void *base, size_t nel, size_t width, int (*compar) (const void *, const void *));
void *
bsearch_b(const void *key, const void *base, size_t nel, size_t width, int (^compar) (const void *, const void *));
DESCRIPTION
The bsearch() function searches an array of nel objects, the initial member of which is pointed to by base, for a member that matches the
object pointed to by key. The size (in bytes) of each member of the array is specified by width.
The contents of the array should be in ascending sorted order according to the comparison function referenced by compar. The compar routine
is expected to have two arguments which point to the key object and to an array member, in that order. It should return an integer which is
less than, equal to, or greater than zero if the key object is found, respectively, to be less than, to match, or be greater than the array
member.
The bsearch_b() function is like bsearch() except the callback compar is a block pointer instead of a function pointer.
RETURN VALUES
The bsearch() and bsearch_b() functions returns a pointer to a matching member of the array, or a null pointer if no match is found. If two
members compare as equal, which member is matched is unspecified.
SEE ALSO
db(3), lsearch(3), qsort(3)
STANDARDS
The bsearch() function conforms to ISO/IEC 9899:1990 (``ISO C90'').
BSD
May 20, 2008 BSD