473,406 Members | 2,336 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Re: strcmp, please help me understand this

you guys are funny. i thought this was comp.lang.c++... not
comp.we.can.only.comment.on things.that.can.be.compiled.c++

back in the day in this group, the jibe replies would've looked like:
"char*'s WILL strcmp, assuming you didn't mean those errors above,
your error is somewhere else."

times change i guess. thanks though joe, appreciate you taking the
time to actually compile that. the error must be somewhere else.
Jun 27 '08 #1
4 1746

"Marcus" <mc*******@walla.comwrote in message
news:b4**********************************@u36g2000 prf.googlegroups.com...
you guys are funny. i thought this was comp.lang.c++... not
comp.we.can.only.comment.on things.that.can.be.compiled.c++
Huh? This is a C++ group. So of course we talk about
C++. Often there are discussions about C++ issues where
actual code is not posted. BUT: you asked about specific
function's behavior under certain circumstances. So of
course we need to know *exactly* what you did.
>
back in the day in this group, the jibe replies would've looked like:
"char*'s WILL strcmp, assuming you didn't mean those errors above,
your error is somewhere else."
This is essentially the same as we're telling you. "the error is
somewhere else." If we don't see what the "somewhere else" looks
like, we're only guessing, and wasting everyone's time.
>
times change i guess. thanks though joe, appreciate you taking the
time to actually compile that.
Please note that he did NOT compile YOUR code. He simply wrote
(I assume correct) code, and compiled THAT. He cannot know what
the rest of your code really looks like.
the error must be somewhere else.
Of course it is. But if you refuse to show us "somewhere else",
we're only guessing. I won't do that.

You're coming awfully close to "biting a hand that feeds you."

-Mike
Jun 27 '08 #2
Marcus <mc*******@walla.comwrote in news:b4aea5d2-b49b-43a7-ab39-
83**********@u36g2000prf.googlegroups.com:
you guys are funny. i thought this was comp.lang.c++... not
comp.we.can.only.comment.on things.that.can.be.compiled.c++

back in the day in this group, the jibe replies would've looked like:
"char*'s WILL strcmp, assuming you didn't mean those errors above,
your error is somewhere else."

times change i guess. thanks though joe, appreciate you taking the
time to actually compile that. the error must be somewhere else.
The point is that strcmp works as advertised, so there is something else
going on corrupting things. Since you are messing with pointers, I would
look for boundary overwrites or writing to invalid pointers. A tool like
Purify can be valuable for finding these sorts of things.

joe
Jun 27 '08 #3
Marcus wrote:
you guys are funny. i thought this was comp.lang.c++... not
comp.we.can.only.comment.on things.that.can.be.compiled.c++

back in the day in this group, the jibe replies would've looked like:
"char*'s WILL strcmp, assuming you didn't mean those errors above,
your error is somewhere else."
What's wrong with that answer? It looks perfectly accurate to me.

Fixing your typing mistakes and putting a minimal complete program
around it makes it work as it should. Thus your lines don't show any
error and thus it's impossible to answer your question.
Jun 29 '08 #4
In article <b4**********************************@u36g2000prf. googlegroups.com>,
Marcus <mc*******@walla.comwrote:
>you guys are funny. i thought this was comp.lang.c++... not
comp.we.can.only.comment.on things.that.can.be.compiled.c++

back in the day in this group, the jibe replies would've looked like:
"char*'s WILL strcmp, assuming you didn't mean those errors above,
your error is somewhere else."

times change i guess. thanks though joe, appreciate you taking the
time to actually compile that. the error must be somewhere else.
Why do newbies insist on being childish? Peoples up here are willing
to help. However, they can only help with the material they have.
But no, so often, newbies when they don't get it all cooked,
pre-chewed and spoonfed directly in their mouth, fell the need to
throw a tantrum.

Look, you came here and asked for help. However, you didn't ask a
clear question ("It doesn't work"). Why are _you_ unwilling to make an
effort yourself so that others can help _you_ solve _your_ problem?
Essentially, all that can be answered from your post:

1- strcmp works.
2- There must be an error somewhere in your code.
3- The sample you have posted is not complete and would not
compile if inserted in a real program.

The above is really not that useful to you: i.e. strcmp works. That
should be a given. But you've have made a mistake. If you post a
complete but minimal self contained example that actually compile,
then peoples can look and identify where you made the mistake. If you
don't do that, all that can be said is: "You made a mistake somewhere."
Yannick

Jun 30 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: muser | last post by:
The following error appears: 'strcmp' : cannot convert parameter 1 from 'char' to 'const char *'. I've already tried using single quotations. the header file only contains the struct contents....
3
by: jl_post | last post by:
Hi, I recently wrote two benchmark programs that compared if two strings were equal: one was a C program that used C char arrays with strcmp(), and the other was a C++ program that used...
11
by: Eirik | last post by:
Shouldn't this code work? If not, why shouldn't it? #include <stdio.h> int main(void) { char yesno; char *yes = "yes";
9
by: Steven | last post by:
Hello, I have a question about strcmp(). I have four words, who need to be compared if it were two strings. I tried adding the comparison values like '(strcmp(w1, w2) + strcmp(w3, w4))', where...
10
by: lchian | last post by:
Hi, For two stl strings s1 and s2, I got different results from strcmp(s1.c_str(), s2.c_str()) and s1.compare(s2) can someone explain what these functions do? It seems that strcmp gives...
1
by: juicy | last post by:
I done a program to read text file, where content is #Header# name: Juicy age: 25 @Header@ #Text# user text here @Text@ #End#
0
by: noobcprogrammer | last post by:
#include "IndexADT.h" int IndexInit(IndexADT* word) { word->head = NULL; word->wordCount = 0; return 1; } int IndexCreate(IndexADT* wordList,char* argv)
47
by: fishpond | last post by:
One way I've seen strcmp(char *s1, char *s2) implemented is: return immediately if s1==s2 (equality of pointers); otherwise do the usual thing of searching through the memory at s1 and s2. Of...
2
by: thungmail | last post by:
There is partial code in C typedef struct message { int messageId; char *messageText; struct message *next; }message; ..... ..... ..... /* Get a node before a node */
0
by: Mike Wahler | last post by:
"Marcus" <mcdesigns@walla.comwrote in message news:f14ccdd1-fa7e-4c5e-ab0a-5ffd6b5a09ec@t12g2000prg.googlegroups.com... No, the code you posted does not compile. If you really want help, please...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.