| |
| |
| |
|
Page: 1 2 3 4 5 6 7
Comments:
<0> not quite sure what he wants <1> He could just explain what he wants properly, I suppose. <0> that would be a start <0> whoah, that's a big step <2> actually i want to convert it to hex bcoz i want to ouput it on LEDs <3> Ummm. Maybe he wants to store an interger in a string. <1> Ah. None of the above. <2> i mean if i use x = 0x0A; printf("%d\n", x);..this will print the result on the screen which i dont want.i want to ***ign the hex value to int Value <1> shahmaan: That makes no sense. <2> why? <1> int x=0x0A; the int contains hexadecimal A. <1> int x=0x0F3; the int contains hexadecimal F3. <2> say x=255 <1> then the int contains hexadecimal FF. <2> i want to convert from dec to hex
<1> How are you interfacing with the LEDs? <3> The computer stores information, not in decimal or hexadecimal, but in binary. You can pull your hex numbers out with boolean logical operators. <2> when i use the command printf("%x\n", x) it converts the x and output it right? <1> shahmaan: It converts the integer to a string which is hexadecimal. <1> The number in the computer's memory isn't hexadecimal. The string that is output that represents the number is hexadecimal. <1> Do you want that string? <2> yeah and outputs it in the terminal <1> shahmaan: sprintf <1> char s[10]; sprintf(s,"%x",x); <1> Then use the characters however you like to feed the leds. <0> i can't help thinking you're doing it in a really complicated way <1> It would probably be more useful to mask off the ibts and shift. But I really can't be bothered to put that much effort in. <1> This method will probably get there in the end. <2> <1>the only thing i want is to convert from dec2 hex which i working printf("%x.\n", number); <0> i think he's not even reading what we're saying <2> wait let me finish :D <1> shahmaan: Are you listening to what we're saying. The integer contained in the computer's memory is neither decimal nor hexadecimal. To do the printf "%d" it creates a string that contains a decimal representation of that number, then prints it. To do the printf "%x" it creates a string that contains a hexadecimal representation of that number then prints it. sprintf does the same, but stores the string in s instead. <1> shahmaan: Don't press enter until you're finished then. You're really skating on thin ice here. <4> Bah. I can't seem to be productive today. <4> Even compared to my usual slack standards. <0> remember the sabbath day to keep it holy <0> :P <4> Is that what you had in mind? :) <5> devc++'s new IDE is quite nice <4> farhan00, still seems sort of 90s era. <5> why's that? <5> well, im coming straight from linux programming, so i like it! <0> rethguals, yeah <5> this book im reading uses WinMain() as the starting point of the program. How does the linker know to start at WinMain() and not main() ? <5> i didn't specify it anywhere <4> farhan00: It knows because you're targetting the Windows GUI subsystem. <4> If you were targetting the console subsystem, you'd like against main as usual. <4> Basically, how does it know to look for main in the first place? <4> You can, of course, override the entrypoint, but in both cases the default is really some function embedded in the run-time libraries which then calls either main or WinMain. <6> helpppp <7> hi <1> That's insufficient information for us to help you, Writeinii. <6> int a=0; printf("%d",a++ + ++a + ++a); <6> int a=0,b;b=a++ + ++a + ++a; printf("%d",b); <6> y r both answers diff :S <6> am using TURBO C 3.0 compiler <4> They're both undefined behaviour, so it matters not. <1> Writeinii: You're not allowed to use ++ more than once, unless there's a , or ; between. <6> undefined how :S .. <1> So whatever the compiler can do whatever it feels like, and not necessarily the same thing for all cases. <4> As wth says, you can only modify an lvalue once between sequence points. <7> hello <7> word <7> get_word ( FILE * fin ) <7> { <7> byte b[4]; <7> fread ( b, 1, 4, fin ); <7> return ( b[0] << 24 ) | ( b[1] << 16 ) | ( b[2] << 8 ) | ( b[3] ); <7> } <7> can anybody <7> help me understand <7> shifting <4> PhoneComp_Specialist: You know how multiplying by ten involves just adding a zero on the end? <4> It's pretty much the same deal, but in binary. <4> So instead of multiply by ten, it's more like two.
<4> ...and I'm being careful to say 'like' because there can be funky happenings with the sign bit, if there is one. <7> can you explain what is mean by FILE * fin <4> In the same way that with "int x" x has type int, with FILE * fin, *fin has type FILE. Normally we say that fin has type FILE*. <4> Basically, fin is a pointer to a file. <7> ah ok <7> meaning it focus on 1 character <4> ...and that's just the way C file IO works; fopen returns a pointer to a type you don't look at. <7> in a file to its location <4> It's not related to the content of the file, its location, or anything else. <4> It's just a thing. <4> Treat it as completely opaque. <7> how it state in vb? <7> i am using vb <4> no it state out vb <4> Of course, that doesn't make sense, but neither did your question. <8> nor does asking a VB questiuon in here, heh <8> -u <7> hehe <7> sorry sir <1> PhoneComp_Specialist: I think he wants us to help him convert that function to VB, but we don't give that kind of help. <7> but just i need to understand <7> how it to read in c <7> nevermind about converting it <7> hehe <9> Open() ? <7> how about this one fread ( b, 1, 4, fin ); <8> need a book on C, heh <7> haha <10> PhoneComp_Specialist, check the help <7> thanks <7> i just try here.... maybe you could help me understand quickly <7> hehe <8> maybe you could hire someone at rentacoder.com to translate for you <7> heh... thankz Fuiru <7> hehe <7> better to read to learn <7> hehe <5> i dislike this autotabbing... <4> auto-indent? <5> yeah <0> how can anyone code without autoindent? :> <5> because the IDE doesn't always get it right <1> six: With the aid of the space bar. <8> or Tab <8> ;p <10> which IDE are you using? <0> farhan00, i rather get it done right 98% of the time automatically, and fix it manually when it's wrong <0> rather than doing it the other way around <8> though, .NET has spoiled me some. I do like the autoindent <0> i hardly ever have to correct vim's indenting <10> what about JBuilder's indenting:p <10> it really ****s <4> Hm... C#'s IDE is getting more and more prescriptive. <4> It now obnoxiously reformats code, like VB6 did. <8> after using .NET, I find VB6 doesn't reformat enough, heh. Won't even auto-tab for me <9> that auto re-format is awful, but I must admit, it forces my students to produce legible code <9> but I could never stand that it would change your case if you typed a variable name differently below. Used to drive me nuts <5> hm...this code is not linking with the following error <5> Undefined reference to `GetStockObject@4` <5> the line is this " wndcl***.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);" <8> forgetting to link to the windows .libs are we ? <5> am i missing some include flie? <5> ohhh, that must be it <8> which is odd, cuz I though VC6 did that automagically <5> im using devC++ <8> ah, that'd be the reason then, heh <5> which is g++. how is this done? <8> dunno myself... probably in the manual, though <5> how it it done in visual C++ ? <8> there're are project properties you set <5> i was thinking there would simply be some dll or static library you would have to link to the code <4> Well, there is. Gdi32.lib <5> what was the name of that library again? gdi32.lib ? <4> Probably.
Return to
#c++ or Go to some related
logs:
#chat-world #linux #india sweetjeev
May Fawaz AND Future TV Kreez script surabaya under cover #india #worldchat #linux
|
|