Forum: C 5 Days Ago |
| Replies: 7 Views: 241 >I was thinking stdin
The stream in question is whatever input stream you want to clean up in a line-oriented fashion, but yes, it was written with stdin in mind.
>Will it be something like this... |
Forum: C 6 Days Ago |
| Replies: 7 Views: 241 >So, in a nutshell, I'm looking for an alternate of the non-standard getch();
Unfortunately, you can't do it in one line without making some assumptions or rolling the whole thing up into a... |
Forum: C 9 Days Ago |
| Replies: 20 Views: 682 >I only posted because I agreed with the OP about our instructor.
>Then you proceed to call me a sock puppet...
Exactly. I call it like I see it, and if you have a problem with that, you're... |
Forum: C 9 Days Ago |
| Replies: 20 Views: 682 >Why even bother posting when someone is asking for help, you have a very poor attitude.
Pardon? You must have missed the fact that I was the first person to help Mattpd in this thread. You must... |
Forum: C 9 Days Ago |
| Replies: 20 Views: 682 >I can vouch for this guy
Yea, that's not suspicious at all. :icon_rolleyes: From past experience, I'm more inclined to believe that you're a sock puppet rather than a concerned classmate. |
Forum: C 10 Days Ago |
| Replies: 5 Views: 324 >Kindly let me know of alternatives of how I could solve this problem.
You're not actually appending to the file, you're appending to lines in the file, which amounts to inserting into the file.... |
Forum: C 11 Days Ago |
| Replies: 20 Views: 682 >I am not certain where to start.
Then you should consider switching your major. "I don't know where to start" is equivalent to "I'm not cut out for programming".
>1. Write a C program that only... |
Forum: C 12 Days Ago |
| Replies: 6 Views: 245 >notice that the argv that i enter exists in the txt.....
Yes, but is it the same string you're comparing against? Remember that fgets does not strip the newline character. If you're comparing... |
Forum: C 12 Days Ago |
| Replies: 6 Views: 245 >if(strcmp(caracter,argv[1]))
strcmp returns a comparison, not a boolean. In other words, 0 is a match and non-zero is a failure to match. Thus, your if statement is reversed. You print the line... |
Forum: C 18 Days Ago |
| Replies: 4 Views: 423 >but many books have this specifier.
I hate to break it to you, but many books are written by people who know little more about C than you do. The lesson about %lf is that printf is not a mirror... |
Forum: C 18 Days Ago |
| Replies: 7 Views: 486 >If you expect your IDE to come fully featured then it won't be lightweight....
The very definition of IDE implies a text editor, a compiler, a debugger, and build tools. vim is a text editor, not... |
Forum: C 19 Days Ago |
| Replies: 4 Views: 423 >i read that the precision of float is 6 digits and double is 10.
No, the precision of float is FLT_DIG and double is DBL_DIG, where both of those macros are defined in <float.h>.
>but it is... |
Forum: C 20 Days Ago |
| Replies: 3 Views: 314 inline: Similar to C++'s inline keyword. It gives you the option of telling the compiler that you want inline expansion rather than real function object code. Inline functions are a safer and easier... |
Forum: C 21 Days Ago |
| Replies: 3 Views: 393 If you know how to use arrays, and you know how to use FILE pointers, you know how to use arrays of FILE pointers. There's really nothing tricky about it except for the number of files you can have... |
Forum: C Sep 20th, 2009 |
| Replies: 3 Views: 283 Amazing. You took the time to add underscores so that your formatting wasn't lost and didn't bother to look for some kind of forum tag that would preserve it for you?
>PLEASE help pps!!
Here's a... |
Forum: C Aug 30th, 2009 |
| Replies: 3 Views: 550 >I'm relatively comfortable with C++ and am taking a class in C for the
>first time. I'm finding it difficult and frustrating to adapt to the new
>language. It's kind of like trying to box with a... |
Forum: C Jun 16th, 2009 |
| Replies: 6 Views: 464 >Wow! Didn't mean to tick you off lady
You didn't tick me off. Apparently you're not used to my direct style of help.
>Sorry if I offended you in any way.
The only thing that offends me is that... |
Forum: C Jun 16th, 2009 |
| Replies: 6 Views: 464 >Well, as I said in my original post
Then you should name the function read_data_from_a_file_and_store_it_in_three_arrays rather than CompareIDs. I didn't ask you what your code does, I asked you... |
Forum: C Jun 16th, 2009 |
| Replies: 6 Views: 464 That function is kind of scary. What exactly is it supposed to accomplish? I'm reasonably sure I can show you a better way to solve the problem. |
Forum: C Jun 13th, 2009 |
| Replies: 8 Views: 856 >The code compiles though.
What you're seeing is a silent extension where the compiler treats the size of void as 1. GCC is wrong to allow it in pedantic mode as it's a constraint violation in the... |
Forum: C Jun 13th, 2009 |
| Replies: 8 Views: 856 >You should perhaps try this:
>void* ptr=but_ptr+20;//this is good
Perhaps you should try it first. You have no excuse for giving an answer that will never compile on a conforming C compiler.
... |
Forum: C Jun 12th, 2009 |
| Replies: 10 Views: 1,081 >but is there a equation to change the characters hex to decimal because
>sometimes if a string got F or A it will just change that to its ascii value.
There is a compact and easy way to do what... |
Forum: C Jun 12th, 2009 |
| Replies: 10 Views: 1,081 Treat it as a variation of K&R's atoi. You should already know that you can step through the string and add the characters like so:
result = radix * result + digit;
If radix is 16, you're... |
Forum: C Jun 9th, 2009 |
| Replies: 18 Views: 868 >As I can say "Build an operating system." is a single step
It is, but you have to increase the granularity of your steps to come up with reasonable milestones. I find it somewhat humorous that you... |
Forum: C Jun 9th, 2009 |
| Replies: 18 Views: 868 >Enlighten me how?
Step 1: Fill the array using rand.
Step 2: Check for zero and if not present, add it to the end.
Step 3: Randomly shuffle the array.
Apparently you have an extremely limited... |
Forum: C Jun 9th, 2009 |
| Replies: 18 Views: 868 >That can complicate things.
Duh. It is an extra step, after all. :icon_rolleyes: On the plus side it adds another level of randomness. |
Forum: C Jun 8th, 2009 |
| Replies: 18 Views: 868 >For the 20th value, if a 0 was not generated, load
>a 0, otherwise get one more random number.
So if 0 was not generated, it'll always be the 20th value? I'd suggest a final step of randomly... |
Forum: C Jun 2nd, 2009 |
| Replies: 5 Views: 663 >when i tried aux=aux->prox
...aux becomes invalid because aux->prox is an uninitialized pointer. Any further use of aux, except to point it to another address, is doomed to failure. |
Forum: C Jun 2nd, 2009 |
| Replies: 22 Views: 945 >Who says using brackets is better?
A lot of people. It's recommended in all coding guidelines I've seen and required in the majority of them. The rationale is that if you add statements to a block... |
Forum: C Jun 1st, 2009 |
| Replies: 22 Views: 945 >i am getting three answers for just one bit on
Can you give me an example? Most likely I'm testing your code based on how it's written, not how you seem to expect it to work. In other words, I... |
Forum: C Jun 1st, 2009 |
| Replies: 22 Views: 945 Perhaps if you explained exactly what you were expecting and how what you got is different... |
Forum: C May 29th, 2009 |
| Replies: 4 Views: 348 1) Functionally, in that situation, the two are the same. What you're seeing in the first example is C's comma operator in action. Occasionally you'll see people use it to avoid braces. Whether... |
Forum: C May 21st, 2009 |
| Replies: 15 Views: 1,270 atoi either returns 0 or invokes undefined behavior. But you can't stop the undefined behavior without carefully validating the string before calling atoi. You also can't tell if the 0 is an error or... |
Forum: C May 19th, 2009 |
| Replies: 1 Views: 352 >do a check to see if the variables exist in my main program
Just how do you plan on doing that? Are you also parsing the code of the main program? If not, do try to remember that variable names are... |
Forum: C May 18th, 2009 |
| Replies: 6 Views: 600 Might I suggest "%ls" instead of "%s"? |
Forum: C May 14th, 2009 |
| Replies: 2 Views: 276 >(*hPtr).style = "abc";
You don't copy arrays like this. You also don't compare arrays with the relational operators either. Further, at this point hPtr doesn't point to anything. You need to point... |
Forum: C May 14th, 2009 |
| Replies: 23 Views: 1,396 >given a function, how do you tell the size of the array that is passed?
Given a function where the only parameter is a pointer to the first element of said array, you don't. There's no portable... |
Forum: C Apr 15th, 2009 |
| Replies: 12 Views: 1,268 Meh, it's your call.
Let's start with some design decisions:
>void timestamp_string (char * myString)
The first thing I notice is the inconvenient notation caused by returning void. You can... |
Forum: C Apr 15th, 2009 |
| Replies: 12 Views: 1,268 >le sigh.
:D
It seems you've suffered enough for that bit of code, so I'll restrain myself. |
Forum: C Apr 15th, 2009 |
| Replies: 6 Views: 746 No, you're supposed to be making changes to the Time function, since that's where the error is and that's where your code is wrong. Allow me to be more hand holdey because you clearly don't get it.... |