Did you check that out?
Type: Posts; User: Maz
Did you check that out?
Well, everyone makes a mistakes with list implementations... It's funny how something so simple tends to go wrong at first attempt - no matter how many lists have you written before =)
Anyways,...
And using for instead while would combine 3 lines in a natural way.
Hi dee Ho peeps!
I wrote a tool for sending custom ethernet packages for Linux. I needed this for some very specific iptables tests, VLAN tests as well as for arp generation. When I wrote this I...
I am not too good with standards, but I will explain you what I've seen in real implementations. I bet others will give specific details about what is required and defined, and what is just assumed...
For my eyes loop is not pretty either. What about
char Posn[4] = {0xff,0xff,0xcf,0x13};
char Posn_be[4] = {0x13,0xcf,0xff,0xff};
short one=1;
int n;
char *tmp=(char *)&one;
if(*tmp)
It would be nice to know a bit more of this. What's the purpose here? TCP itself is a protocol taking care of retransmissions if needed.
I guess choosing IDE really is a matter of taste. Most of us have propably tried a bunch of them, and then stuck with one that suits them best. Same goes with the environment in general (like...
/* You're evaluating s[i+1] here... When will s[i+1] be set? */
if (s[i] == '/' && s[i+1] == '*') /*entering the comment*/
I just had to like this a bit more =) command line terminal with minimal display... Resisting everything new... Recognized some parts suiting me. Utopia is still the best strategy computer game. Unix...
well. I try not to argue. At first I just impressed my dislike using word "type" with C strings. Reason was that for me word type suggested that "thing" which we are talking about has known size thus...
Correct. assignment / comparison wont work for arrays either.
Mmm.. What do you mean by saying that sizeof() works for C strings?
char str[20]="foobar";
there str is an array, but not...
Actually, I would not say the C-strings are a composite type. I'd say they're not data type, they're data object.
For (compatible) types, assignment would work. For types, comparison would work....
furthermore, explaining C strings as type gives false idea of what they are. It encourages you to use assignment with strings.it encourages using sizeof() badly. It is plain ugly way to explain...
Actually I never said I am writing C standard here. Nor did I say one must not simplify things. However, according to my experience, in order to be able to use C effectively you need to understand...
well, I give up. It's of course your business why you want to manipulate text ptr. you could propably avoid temp ptr, but we cant help unless we know what you plan. Just do not use allocated memory...
I see what you do, but why? Looks like you're getting rid of the first letter of name?
memmove is heavyish operation. So I would like to ask why you're doing it? Maybe, just maybe you could go on...
I usually use
shm_open()
ftruncate()
mmap()
sequence. You propably will also need sem_open, sem_wait and sem_post to synchronize the access to shm. You propably do not want clients being...
This is true. And by no means do I say that there's something wrong with it. However I personally hate this approach.
For me there is no such fundamental type as string in C. There is just type...
\b does not really remove anything from your string. It is a terminal escape code, which alters the way a string is shown in terminal. It does not however remove any characters from your string. If...
C is not a scripting language. Thus the function names are not really usable at runtime, when your variables get evaluated.
You could accomplish this using function pointers - Eg,
void ...
Since it looks like the OP has not been interested in commenting this topic lately, I would like to ask which part of my source was so horribly broken? I simply do not spot that myself. So please...
In this example? Nothing. Absolutely nothing.
Depending on what such a list does contain - possibly a lot. Maybe it would be a message queue? Networking protocol stack? Maybe a slab memory pool,...
Allright. Yes. Naturally linked list itself gets scattered. But we do not get yet another block of memory for allocated character array.
eg, instead of
[list header] -> [ char array]
|...
The one character array is accesspoint to data (a placeholder), appended at the end of the struct. As you can see from init function, there will be space allocated at the end of the struct. That way...