473,811 Members | 3,208 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Re: strcmp, please help me understand this

you guys are funny. i thought this was comp.lang.c++.. . not
comp.we.can.onl y.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 1785

"Marcus" <mc*******@wall a.comwrote in message
news:b4******** *************** ***********@u36 g2000prf.google groups.com...
you guys are funny. i thought this was comp.lang.c++.. . not
comp.we.can.onl y.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*******@wall a.comwrote in news:b4aea5d2-b49b-43a7-ab39-
83**********@u3 6g2000prf.googl egroups.com:
you guys are funny. i thought this was comp.lang.c++.. . not
comp.we.can.onl y.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.onl y.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************ *************** *******@u36g200 0prf.googlegrou ps.com>,
Marcus <mc*******@wall a.comwrote:
>you guys are funny. i thought this was comp.lang.c++.. . not
comp.we.can.on ly.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
12484
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. The whole program is part of an example found in my course work. Does strcmp only compare two sets of strings or can it be used to determine the end of the string as well? #include<iostream>
3
17134
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 std::strings with operator==(). In both programs, the first string consisted of one million characters (all the letter 'a'). The second string was always one character longer than the first string (with the letter 'a' for all the
11
5887
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
5279
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 w1 and w2 make up the first string and, w3 and w4 make up the second string. I do not want to allocate memory, then put the words together to create a string only to facilitate strcmp() comparison. My question; Does anyone know how to get the...
10
14490
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 the "right" (i.e.wysiwyg) answer while compare() does not.
1
1829
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
2189
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
3033
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 course the reason for doing this is to save time in case equal pointers are passed to strcmp. But it seems to me that this could create an inconsistency in the degenerate case when s1 points to memory that is not null-terminated, i.e. by some freak...
2
2093
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
1211
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 listen to what Alf (and I) are telling you. Post a *complete*, *compilable* program (ALL of it, including header #includes), or we simply cannot help you. -Mike
0
9734
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9607
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10397
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9214
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7674
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6897
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5564
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4353
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3027
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.