Solved

called object is not a function

Posted on 2006-07-16
6
3,294 Views
Last Modified: 2008-03-03
Hi I am getting error in the following line....

int m=0;
for(l=0; txt[l] != '\0'; l++)
  {
      if((txt[l] != ' ') && (txt[l] != '\r')  (txt[l] != '\n'))
      {
            str[m]=txt[l];
          m++;
      }
  }
  str[l]='\0';

txt is of type const char *txt
char str[1000];

error message "called object is not a function "


0
Comment
Question by:sudarshantk
6 Comments
 
LVL 5

Expert Comment

by:dennis_george
ID: 17119702
The following statement in your program is ill-formed....
if((txt[l] != ' ') && (txt[l] != '\r')  (txt[l] != '\n'))

each condition should be separated by a conditional statement....
e.g.
if( (txt[l] != ' ') && ((txt[l] != '\r') || (txt[l] != '\n'))  )

0
 
LVL 14

Expert Comment

by:cwwkie
ID: 17121313
should probably be and instead of or:

if( (txt[l] != ' ') && ((txt[l] != '\r') && (txt[l] != '\n'))  )

otherwise the whole statement would not make much sense.
0
 
LVL 3

Accepted Solution

by:
DineshJolania earned 125 total points
ID: 17239859
Compiler assumes that following syntax is a function
(txt[l] != '\r')  (txt[l] != '\n')   and hence the error.
0
 

Author Comment

by:sudarshantk
ID: 17453386
Thanks
0

Featured Post

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
The goal of this video is to provide viewers with basic examples to understand opening and writing to files in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question