program bug

  • Thread starter Bill Cunningham
  • Start date
V

vippstar

I see.

which is itself as single statement. (The same


I think braces are required with if.
No they are not. You know it, you could try it, you could read about
it.
*OR* you could just read what mr Keith said; *the* *same* *thing*
*applies* *to* *if* *statements*.
Just once more, just in case:
*the* *same* *thing* *applies* *to* *if* *statements*.
Now, every day you wake up, you should run this commant in your
terminal: 'yes the same thing applies to if statements', until you
memorize it. Then you can chant it quietly, until you understand it.

Mr Keith (and anyone else who actually cared to reply to this troll)
I'm really tired of seeing clc replying to him.
Assuming he is actually not able to learn after so many years, and
assuming he can't understand what he reads in usenet messages (as
shown just now), you are simply not helping him. Just how stupid does
one have to be to say "I think B isn't" when you say "A is, same
applies for B?"
And what's up with all the horrible indentation he comes up with every
single time, the horrible questions "is anyone good enough to [...]"
in his original message, which could simply be answered with
"yes"/"no", the repeating mistakes, the tendency to reply without
quoting, taking quotes out of context (notice his reply to Mr Gamble)

Honestly, I'm tired of these threads. I also think I make a fool of
myself, since such replies most likely entertain him and the other
trolls...
 
K

Keith Thompson

Bill Cunningham said:
I see.

which is itself as single statement. (The same

I think braces are required with if.
[...]

You're guessing. Don't guess. Look it up.
 
D

Default User

Keith Thompson wrote:

From now on, if you post a chunk of nearly illegible code like what
you posted upthread, with no indentation and virtually no whitespace,
I will ask you to format it properly before I'll even consider helping
you fix any other problems.

It will feel good once you stop beating your head against the wall.





Brian
 
E

Eligiusz Narutowicz

Bill Cunningham said:
I see.

which is itself as single statement. (The same

I think braces are required with if.

Did you ever try to read a C book? It seems you do not have much of an
idea of anything or what braces are for.
 
B

Bill Cunningham

Eligiusz Narutowicz said:
Did you ever try to read a C book? It seems you do not have much of an
idea of anything or what braces are for.

k and r 2 can sometimes go over my head. So I don't use it much but I do
have a little handy dandy little book called "C pocket reference". It's what
I do most of my reading from. It's a small reference and not a big tutorial
but it's pretty easy for me and on my level much more than some texts.

Bill
 
B

Barry Schwarz

k and r 2 can sometimes go over my head. So I don't use it much but I do
have a little handy dandy little book called "C pocket reference". It's what
I do most of my reading from. It's a small reference and not a big tutorial
but it's pretty easy for me and on my level much more than some texts.

Is this something you found on the web or did you buy it. Can you
provide a reference so we can check to see if it is the source of
misinformation you seem to be suffering from?


Remove del for email
 
B

Bill Cunningham

Barry Schwarz said:
Is this something you found on the web or did you buy it. Can you
provide a reference so we can check to see if it is the source of
misinformation you seem to be suffering from?

It's a very small paper back book. Like a reference. From Oreilly books.

Bill
 
N

Nick Keighley

    I have looked this program up and down and I don't see what's wrong with
it. But it always breaks and gives me an error "mode error" no matter which
mode binary or text I choose. This simple program is supposed to take as
argv[1] a "b" or "t" for binary or text. It's not taking anything.

#include <stdio.h>

int main(int argc, char **argv) {
 char *b;
 int a;
 FILE *ifp,*ofp;
 if (argc!=4) {
 fprintf(stderr,"usage error\n");
 return -1;
 }
 if (argv[1]=="b") {
 b="rb";
 }
 if (argv[1]=="t") {
 b="rt";
 }
 if (argv[1]!="t"||argv[1]!="b") {
 fprintf(stderr,"mode error\n");
 return -1;
 }
 if ((ifp=fopen(argv[2],b))==0) {
 fprintf(stderr,"open error i\n");
 return -1;
 }
 if ((ofp=fopen(argv[3],b))==0) {
 fprintf(stderr,"open error o\n");
 return -1;
 }
 while(a!=EOF)
 a=fgetc(ifp);
 fputc(a,ofp);
 printf("done\n");
 return 0;}

    Is anyone good enough to glance at this and see what's wrong?

your space key is broken.
You can't be bothered to indent your code.
I can't be bothered to read your unindented code.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,781
Messages
2,569,616
Members
45,306
Latest member
TeddyWeath

Latest Threads

Top