Thread: Searching and matching strings: segmentation fault

  1. #16
    Registered User
    Join Date
    Jul 2005
    Posts
    7
    Thank you Laserve for your more detailed reply. I can see you don't find it too much of a hassle to tell me that "%c" is the correct syntax. I will change it right away.

    However my biggest problem is not solved. The first name of the first record in the file still won't show when I request it during the application being run. Choosing a category has never been a problem; it's bringing the file information up correctly that is. As for the program compiling, I only receive 2 warnings, which identify with lines 91 and 109 and are shown in quzah's last reply. I assume his other problems are because of the $ at the end of one of the lines. It is only there to represent more information but still have the code remain on one line because my telnet compiler will give me more errors if it is not on the same line. Just close the tag on that line and it will work fine.

    I suppose this is an unsolvable problem for quzah or he is just a bit lazy or in fact doesn't care enough to fix it on his own and then GUIDE me toward the answer in a respectable way. Laserve, perhaps you can find an answer. As it is, I have run out of ideas.

    For the record, I have spent hours trying many different things to work. I am an amateur C programmer at best without a teacher and working off of other language experiences I have had (BASIC, pascal, Visual Basic, C++). If only I had as much knowledge as the almighty....

    Quzah.

  2. #17
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    No, actually they have nothing to do with the $, because that problem wouldn't even allow a compile. Furthermore, none of those warnings are on the same line as eachother, so they can't all be because of your paste job.
    I suppose this is an unsolvable problem for quzah or he is just a bit lazy or in fact doesn't care enough to fix it on his own and then GUIDE me toward the answer in a respectable way.
    I'm lazy? I'm the only one that's replied here. How is me not doing all of your work for you, and trying to get you to think for yourself being lazy? ........ you, you ingrate. My FIRST REPLY had all the answer you needed for your entire thread. Did you pay attention to it? No. You whined because I didn't do everything for you.

    You didn't need to "spent hours trying many different things", all you had to do is pay attention to my first post, and all of the other posts where state:
    A single character is not a string.
    A string is an array of characters terminated by a null character.
    Also, you still aren't paying attention to my first post:
    Code:
    char category;
    Code:
    scanf("%s", &category);
    2) I didn't suggest you not use the ampersand. I suggested you actually pay attention to what you're declaring and use it correctly:
    a) If you want a string or an array, declare it as such.
    b) If you want a single character, then stop using %s in your scanf call.
    However, since they can't decide if they're using single characters or strings
    Like I said, read your chapter on strings over again. Also, actually pay attention to your code. You didn't declare a string. That's the whole problem.
    Code:
     char category;
    Do you see an array there? I sure don't.
    You do not use %s for single characters.
    I'm LAZY? I said it seven ........ing times! How many more times do I have to say it? SEVEN TIMES! Did you pay attention to even one of them? No. So I said it again, and again and again... Get the point? I'm lazy? Shut the ........ up.


    Quzah.
    Hope is the first step on the road to disappointment.

  3. #18
    Sweet
    Join Date
    Aug 2002
    Location
    Tucson, Arizona
    Posts
    1,820
    Hi quzah
    Woop?

  4. #19
    Registered User
    Join Date
    Jun 2004
    Posts
    201
    Quote Originally Posted by quzah
    I'm LAZY? I said it seven ........ing times! How many more times do I have to say it? SEVEN TIMES! Did you pay attention to even one of them? No. So I said it again, and again and again... Get the point? I'm lazy? Shut the ........ up.

    Quzah.
    breathe baby

    <3

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM