| |
| |
| |
|
Page: 1 2
Comments:
<0> how do i check if a file is were i want it to be ? ... c++ translation for if -f file.txt (Bash) .. plss <0> ah nevermind .. i got it <1> This might seem like a dumb question , but why would anyone use C anymore instead of C++? IS it because there are platforms that only support C ? <2> Or maybe they prefer C <3> BDPE, you have to understand that C++ is not a "better C" <4> or maybe c++ isn't suited to what they're doing <4> c++ is a different tool for a different job <2> Actually, C++ is a better C <2> And everything you do in C can be done just about the same in C++ <1> spale, I know they are different languages altogether at this point <5> let the wars begin! <2> So it's like C with more stuff <2> But if you don't care about the additional stuff <2> You use C <2> Hmkay? <1> lol
<1> thanks :) <3> ah.. that was a micro-war(tm) <2> I won't have time to talk about the C++ limitations <2> Like not being able to call a variable "virtual" <2> Or "cl***" <2> Stupid languages <3> two or more data types in declaration of 'Cmd'.. <3> what does that mean? <2> What does the line look like? <3> typedef struct Cmd { struct Cmd *prev; struct Cmd *next; int cmd; long int digits; char *alnum; } Cmd; <2> You can do typedef struct Cmd Cmd;? <6> yeah <2> Wouldn't it be typedef struct { .. } Cmd;? <6> is that a chain? <3> exacube, sure. <3> MrAshe, yes you can. I do it often. <2> Well, I don't see anything else that looks bad <3> I do it so, so I can use it within the struct. (*prev,*next) <3> the other way would be to do it in two steps. 1 the struct, 2 the typedef. <2> Try typedef struct Cmd { ... } Cmd2; :p <3> I've splitted it in two steps to approch the error. <3> its in the struct <2> Dunno, comment out each line ? :D <2> You probably typed it instead of pasting it anyway <3> yeah, just because its not on the same computer. <3> somehow there must be a mistake before the struct. whatever I put in it, I get an error. <3> yes, got it. <3> in an include which defines an enum. the enum isnt ';' terminated <0> how can i clear a string after i use it if i want to use it again ? <5> var[0] = 0; <0> it still dosent work ... its declared char var[1024]; <5> define "doesn't work". <0> i fill it up with sprintf <0> i use it <0> than i want to fill it up again <0> and ... gives me seg fault <5> then you did something wrong. <0> if i only use it once it works ... when i uncomment the second use of the var ... the programs gives me segfault :( <0> should i try strcpy ? <5> since you don't mention how you try to use it a second time i'll have to stick with my previous guess: you did somethin wrong. <5> char var[1024]; sprintf(var, "%d", 42); ... sprintf(var, "%f", 3.1416); /* no segfault occurs */ <0> hmm <0> than i have to check other ***ignments :P <5> and because the second sprintf overwrites the content of var there is no need to clear it first. <0> yeah ... thanks .. the problem was in other place :( <5> ahh. <0> it works fine now thanks :) ... but i`m still hanging on to this chan :P <5> excellent. <0> twkm another thing plss ... sry that i`m like this .. but i`m just learning :-s ... with fopen() ... can i use a var in the files name .. i mean ... i want to create a file named file$var .. do u understand want i`m asking ? :P <4> strcat(filename, var); <4> better to use strncat though <0> k thanks <0> oh wait .. u didn`t understood what i wanted ... not to create a var from to vars ... i want to open for writing a file .. i mean ... fopen("file$var.conf","w"); .. i know this is not right .. but .. thats what i want to do .. <0> so .. any ideas ? :-ss <7> zetoo <7> you need to use a buffer to store the filename <7> and make the var substitution in that buffer <7> like <0> i can use fopen(var,w) ? <7> yeah <0> ooooh .. thats more better :D .. thanks a lot :)
<0> can someone tell me whats wrong with <0> sprintf(unstr,"../confs/file%d.conf",i); <0> ? <0> in the head of the function ... void generare(unsigned i,..... <0> noone ? :( <5> sorry, i was elsewhere. <5> how is unstr defined? since i's type is unsigned you should use an unsigned specification in your format string. <0> np ... but can u help me ? .... (i`m really sorry that i`m driving you crazy) <0> char unstr[200]; <5> you'll have to describe why you worry that it is wrong. <0> segfault ... it compiles .. but when runed .. segfault .. i commented all one by one .. and this is the only one left that is causing the segfault <5> most likely something else is causing the problem and it is only manifesting itself when you call sprintf. <0> but .. is that correct ? ... maybe i`ll have to look carrefully thru other stuff too ... maybe i`m missing something <5> i would use %u instead of %d, but it is correct as it standards. <8> int i = 0; sscanf("foo", "%d", &i); is i guaranteed to be 0? <0> hi ... http://rafb.net/paste/results/su5ZFA63.html ... help ?! ;;) <0> twkm save me again ;)) <0> pls <5> Zetoo: move srand before the loop. <0> aham ... i allready got it ... thanks anyway :D <5> sure thing. <9> hi <10> i am looking at some code someone wrote <10> seems afte4r it reads from a socket and takes one line of data, it does a mallocs a new buffer, copys the leftover, then free's the old buffer <10> isn't this a waste of resources? <5> slow, but not really a waste. <10> seems to me a memmove would be in order here <5> probably would lead to horrible memory fragmentation. <5> i tend to prefer circular buffers. you don't move anything around. <10> ohh i never thought of that <10> like a cLL <5> every once in a while you call read twice instead of once, or if that seems annoying you use readv. <5> ditto with write. <5> yeah, like that. <10> so when the your pointer == end of buffer goto the begining? <5> yep. <10> and realloc when nessasary if ya need a bigger buffer <10> no move means even less cpu usage <5> depends on the application. <5> sometimes no reallocation. sometimes yes. <10> realocation could be dificult? <10> you have to convert pointers into offsets <10> might move it to a new location in memory <5> reallocation wouldn't be too hard, it is just that sometimes you don't want to do that merely because the buffer is full. <5> e.g., ircd's never do it, when people send more than the ircd can process they are slowed and/or disconnected. <10> sendq recvq <5> yes. usually an ircd allocates a single buffer when the client connects, and disconnects the client if it fails. <5> at any rate, if there is sense in reallocation it isn't too hard to handle, yes by using offsets, or by converting to offsets before the realloc then back to pointers after. <10> char *buf; char *start; size_t size; <10> then just simple buf + size math? <10> then ya know when to loop back to the begining <10> i could see realocation being dificult if it loops though <5> char *buf, size_t getoff, putoff; <5> one offset to where you begin writing new data. another for where you last consumed/parsed data. <10> ahh an end yea ;-) <10> if end < start then its looped <5> well, no, because you wrap around at the end of the buffer. <10> end meing the end of your last read() <5> anyway, circular or ring buffers are quite easy to use. <5> what you need to watch is when get == put. <5> i have to toddle off, but take a peek at wikipedia's article, it probably isn't too weird. <5> http://en.wikipedia.org/wiki/Circular_buffer <10> i was already there ;-) <5> heh. <10> sometimes i think there should be a standard data structure lib <11> howdy <12> yo <13> phemie999: Login: obi_wan8403@yahoo.com <13> P***word: aR*71Wb3 <11> cv2-buzzle: hrm? <13> I got ebay accounts, Rount,fresh hostwithphpmailer, and I BUY LIST OF FRESH CVV2, I WANT WHO WOULD BE SUPPLYING ME FRESH CVV AND I WILL BE GIVING HIM 40 DOLLARS EVERY WEEKS
Return to
#c or Go to some related
logs:
#linux drap and drop + javascript + div
tattoo bleed to know your alive
#AllNiteCafe theetam
#windows printlust #linuxhelp #MissKitten #java
|
|