Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-4041-

HELP please

Name: Anonymous 2010-07-06 12:35

what is wrong with my program? its supposed to process arguments but it doesnt.
void output(char *fuckyou);
int main(int argc, char **argv) {
  int i;
  for(i = 0; i < argc; i++) {
    output("SHIT");
  }
}

Name: Anonymous 2010-07-06 12:37

you forgot to code output

Name: Anonymous 2010-07-06 12:38

>>2
no i didnt.
it works by the way.

Name: FrozenVoid 2010-07-06 12:57

void output(char *fuckyou);<--accepts only pointers


__________________
Orbis terrarum delenda est

Name: FrozenVoid 2010-07-06 13:02

Try this:
inline void output(char const text[]){puts(text);}
int main(){output("abc")}


__________________
Orbis terrarum delenda est

Name: Anonymous 2010-07-06 13:03

>>4
Learn C please.
>>1
How about you do something with i, argc or argv (i.e. process them) instead of just output()ting "SHIT" for each one?
That's why it's not processing them. Because you didn't tell it to.

Name: Anonymous 2010-07-06 13:14

>>6
The SHIT thingy is just a placeholder, it desnt even enter the loop, that is my problem

Name: Anonymous 2010-07-06 13:20

I compiled my program without libc, is that a problem?

Name: Anonymous 2010-07-06 13:20

>>7
Fuck off, ``faggot''.

Name: Anonymous 2010-07-06 13:29

>>7
Have you given it any arguments?

Name: Anonymous 2010-07-06 13:30

>>10
Yes, lots of them.

Name: Anonymous 2010-07-06 13:33

>>11
Maybe you should be nicer to it.

Name: Anonymous 2010-07-06 13:35

>>12
nope, doesnt work either.

Name: Anonymous 2010-07-06 13:37

>>13

Judging by your response, you don't know how to be nice.

Name: Anonymous 2010-07-06 13:38

>>14
I dont have to know, i got man pages.
nice [OPTION] [COMMAND [ARG]...]

Name: Anonymous 2010-07-06 13:41

>>15

That fact that it doesn't work is proof that you do have to know.

Name: Anonymous 2010-07-06 13:41

i++
I found your problem. You're a Sepples programmer.

Name: Anonymous 2010-07-06 13:43

>>17
Scuse me?

Is it even possible that this might be a error of my side? Or must the compiler simply have fucked up?

Name: Anonymous 2010-07-06 13:46

Here's a hint: if you want people to troubleshoot your code, post all of your code instead of just the bit you think is fucking up. You didn't manage to figure out the problem on your own, so chances that you'll be able to successfully identify the right bits of code to post yourself aren't that great.

Bonus hint: it's never a compiler problem.

Name: Anonymous 2010-07-06 13:46

>>18
He mena i = i + 1

Name: Anonymous 2010-07-06 13:47

>>19
Ultra mega bonus hint: ``it doesn't work'' means fuck all.

Name: Anonymous 2010-07-06 13:54

>>19
I have a LOT of code, so posting here is not really an option.
And seriously now what else could it be?

Name: Anonymous 2010-07-06 13:55

>>20
Or maybe ++i, the idiomatic way to increment a variable that K&R uses throughout.

Name: Anonymous 2010-07-06 13:56

>>22
Perhaps something before that loop that you may have gotten rid of?

Name: Anonymous 2010-07-06 14:00

>>22
Random guess: your output function. Or a return or exit before the loop. Or something that clobbers the value of argc before the loop.
You shouldn't have ``a LOT of code'' if tracking down a problem like this is beyond you.

Name: FrozenVoid 2010-07-06 14:00

>>22
Pastebin.com <--learn to use it


__________________
Orbis terrarum delenda est

Name: Anonymous 2010-07-06 14:01

>>24
No, there is nothing before that loop.
Parameter procession is the very first thing this program is supposed to do.

The functions after the loop work fine tough. And GCC does not complain about anything in this function.

Name: Anonymous 2010-07-06 14:04

>>27
Replace output with a more sensible alternative, like printf or puts.

(Depending on what kind of arguments you're processing, look into getopt as well; that's neither here nor there, though.)

Name: Anonymous 2010-07-06 14:08

>>28
ld refuses to link glibc and i dont know of any other output functions.

And i am dead sure output works as intended.

Name: FrozenVoid 2010-07-06 14:11

>ld refuses to link glibc
Lunix developer using "newest glibc"?

__________________
Orbis terrarum delenda est

Name: Anonymous 2010-07-06 14:16

>>29
ld refuses to link glibc
See, that's a bit of information that would have been useful from the very beginning.

Name: Anonymous 2010-07-06 14:17

>>31
How is that relevant?

Name: Anonymous 2010-07-06 14:18

>>32
When your program doesn't work as intended and your linker isn't producing the binaries you expect without error? Hmm.

Name: Anonymous 2010-07-06 14:21

>>33
It does produce the binaries as expected, it just doesnt work with libc.so specificly.

Name: FrozenVoid 2010-07-06 14:25

>>34
You need either:
1. fix your glibc
2. use alternative like http://www.fefe.de/dietlibc/
3. switch to easier language like Python/Ruby/JavaScript

__________________
Orbis terrarum delenda est

Name: Anonymous 2010-07-06 14:27

>>35
Thanks FV, i will try this alternate lib you linked me too.

Name: Anonymous 2010-07-06 14:39

Hey is there any reason that Allegro's masked_blit() suddenly fails to transparentize 255,0,255?

Cool thread btw.

Name: FrozenVoid 2010-07-06 14:44


void masked_blit(BITMAP *source, BITMAP *dest, int source_x, int source_y, int dest_x, int dest_y, int width, int height);
Like blit(), but skips transparent pixels, which are marked by a zero in 256-color modes or bright pink for truecolor data (maximum red and blue, zero green), and requires the source and destination bitmaps to be of the same color depth. The source and destination regions must not overlap. Example:

      BITMAP *hud_overlay;
      ...
      /* Paint hud overlay on the screen. */
      masked_blit(hud_overlay, screen, 0, 0, 0, 0,
          hud_overlay->w, hud_overlay->h);



If the GFX_HW_VRAM_BLIT_MASKED bit in the gfx_capabilities flag is set, the current driver supports hardware accelerated masked blits from one part of the screen onto another. This is extremely fast, so when this flag is set it may be worth storing some of your more frequently used sprites in an offscreen portion of the video memory.

Warning: if the hardware acceleration flag is not set, masked_blit() will not work correctly when used with a source image in system or video memory so the latter must be a memory bitmap.


__________________
Orbis terrarum delenda est

Name: Anonymous 2010-07-06 15:01

>>32
It demonstrates your build environment is fucked beyond redemption. Fix it.

Name: Anonymous 2010-07-06 15:04

>>35
Hey the lib you linked too works, thanks a thousand times. But my program still doesnt work as intended.

Name: Anonymous 2010-07-06 15:08

>>40
Start again. 80/20, and all that.

Name: FrozenVoid 2010-07-06 15:10

>>40
1. open Pastebin.com
2. post errors in a new pastebin.
2. post source code in new pastebin.(if its not possible, post the relevant functions and their immediate places within main)

__________________
Orbis terrarum delenda est

Name: Anonymous 2010-07-06 15:12

>>42
The second step 2 should include the entirety of main().

Name: Anonymous 2010-07-06 15:32

>>43
>>42
>>41

The thing is simple: the part i posted doesnt work, everything else does.

Everything i posted is everything thats wrong right now, there is no shit before this and gcc does not print any errors in main().

I have like a lot of shit in my project folder, and most of my code is fucking ugly and buggy in such ways that i would shame myself in the ground if anyone saw it, but it still somewhat works, tested it like a thousand times.

Still want me to post it?

Name: FrozenVoid 2010-07-06 15:41

>>44
Post it anyway, it not like you signed every line with Joe Coder Random(c) GPL


__________________
Orbis terrarum delenda est

Name: Anonymous 2010-07-06 15:41

>>44
JUST FUCKING DO IT YOU CAME TO /prog/ FOR HELP THERE'S NO MORE EMBARRASSMENT LEFT JUST DO IT

ALSO IF output DOES WHAT IT SAYS THEN THE PROBLEM CLEARLY LIES SOMEWHERE ELSE

Name: Anonymous 2010-07-06 15:45

>>46
It is terrible, i mean really terrible code!.

Name: Anonymous 2010-07-06 15:47

Man, if would be nice if C didn't require >>punctuation<<, wouldn't it, >>1?

Name: Anonymous 2010-07-06 15:47

>>47
Then get the fuck out. Terrible code is posted here on daily basis.

Name: Anonymous 2010-07-06 15:50

>>47
This reminds me of the story of the shy girl. All her friends wanted her to sing for some reason, and she was all "no i'm terrible :3" and they were insistent. Eventually, when their attention was elsewhere, she plucked up the courage to sing. One of them noticed and told the others to shut up.
She sounded like a diseased macaw. Nobody spoke of that moment again.

Name: Anonymous 2010-07-06 15:50

>>49
Terrible code is posted here on daily basis.

I really havent seen any code here, or atleast not much.

Name: Anonymous 2010-07-06 15:51

>>51
Okay. Post code or get out. You're fucking anonymous.

Name: Anonymous 2010-07-06 15:54

Alright, but i have many files, mostly filled with half finished ASM. Should i post it too, or just stick with the C?

Name: FrozenVoid 2010-07-06 15:58

>>54
It could be exactly why it does not run, asm isn't meant to be "half-finished", it either runs or crashes.


__________________
Orbis terrarum delenda est

Name: Anonymous 2010-07-06 16:00

>>54
Well it runs alright, but much functionality is missing.

Name: FrozenVoid 2010-07-06 16:02

>>55
What if one of your C functions tries to use something which has "functionality is missing"?


__________________
Orbis terrarum delenda est

Name: Anonymous 2010-07-06 16:05

>>56
It doesnt, and even if it does not crash.

Name: Anonymous 2010-07-06 16:07

Mmm, premature optimisation.

Name: FrozenVoid 2010-07-06 16:14

Couple advices:
1. Stick to straight C until your program runs perfectly.
2. Only introduce asm blocks to optimize inner loops/functions.
3.use only complete, tested assembler subroutines and have a fallback for normal C-only operation.
4.Don't develop software out of your league(OS/Drivers/etc)
__________________
Orbis terrarum delenda est

Name: Anonymous 2010-07-06 16:14

>>58
Step the fuck back, let FV handle his brother in disrespecting punctuation.

Name: Anonymous 2010-07-06 16:17

Name: Anonymous 2010-07-06 16:18

>>59
5. Write useless "helper" files that serve to only confuse everyone else.
6. Forget whitespace. It's just screen bloat.

Name: Anonymous 2010-07-06 16:21

>>61
And thus the physical representation of cdr is in fact an African American smoking weed every day.

Name: Anonymous 2010-07-06 16:25

OP here.

>>59
Good advice but too late.
Thank you for that library link you posted, sure will be helpfull for me.

Also thanks to anonymous.

Its already late here and have too take a bath. I will try haxing this thing until it works somewhat.

I hoped i could resolve this fast with /prog/s help and that you could laugh at this silly thing, but seems isnt the case.

I will check out this thread in the morning, to see if it has been threadstoped, if you guys are interested in the src, let me know so i can tidy up a bit and post it.

Anyways im sure i can fix this.

Good night.

Name: Anonymous 2010-07-06 16:28

I will check out this thread in the morning, to see if it has been threadstoped
Oh my.

Name: Anonymous 2010-07-06 16:35

int main(int argc, char **argv){
  while (--argc)
    output(*++argv);
  return 0;
}

Name: Anonymous 2010-07-06 17:05

>>66
Why would you maul poor innocent argc like that? I feel kinda bad about it :(

Name: Anonymous 2010-07-06 17:13

>>67
Because I am an expert C programmer.

Don't change these.
Name: Email:
Entire Thread Thread List