I want to modify certain outgoing packets from my Windows XP box. What would be the easiest way to do this?
(e.g. if the dest.port == 2500, then slap on another TCP/IP header with dest.port==25 and dest.ip==11.22.33.44 -- encapsulation or IP tunneling, I guess)
I tried finding a program or...
Update: I have just found that if I change my client to loop on the recv() call, it will receive numerous packets, but the server will send the whole thing with only one call to send(). Has send() been changed to always send the entire thing in a single call?
Now wait a minute. In Windows, if I am reading a file, am I going to need to use "\r\n" to represent a newline character? I thought that C would merge them together (to keep programs portable) into a single '\n' character. Is this wrong? Here's why I am thinking this way:
"As...
OK, here's my program.
#include <stdio.h>
#include <string.h>
void minprintf(char *fmt, ...);
/* prints a few lines of output, to test minprintf */
int main()
{
int i = 321;
double ld = 43.5939232223;
char s[] = "The quick brown fox jumps over the lazy dog."...
...as a pointer to the first element of the array"
Hmmm... So, are you saying that the array variable (the pointer to the first element of the array) isn't an actual variable when the program is run? (the compiler would basically replace c[5] with *(&ch + 5) if ch was the first element?)
...that sizeof 'A' returns 4 because 'A' is really a pointer to the character constant A. Kind of like how you can have a function:
char blah(char *s)
{
return *s
}
And call it with:
blah("Hi");
That is one of those things that I never REALLY understood, but I'm guessing that I...
Okay, I'm sort of confused about how sizeof works. Can I really use sizeof anywhere in the program (except #if statements) just like it is a function, or something? All of the sizeof's are replaced by the actual size of the object, right? The reason I'm asking, is this program:
#include...
Are you saying that, when I define some array, it puts that array somewhere in the middle of some special "read/write" memory area, and I'll only get a segmentation fault if I try to access a memory location outside of that entire read/write memory area?
Heh, actually, I did set those two spots to output Hi. (s[-5] = 'H', s[400] = 'i';) And the *s = 0 not working is really what confused me. I would understand if s[-5] did not work also, but that does. And I can initialize the pointer *s with "Hi there", but cannot modify it...
Oh, well I do get Segmentation Faults when I try to modify anything related to *s. However, if I use the array s[], I don't get them. (I can make a negative index, or just an index larger than the array was defined, and it won't give me any error) I just tested this again:
char s[25];
s[-5]...
...any errors running the program. I expected to get a Segmentation Fault, but I didn't.
Here's another thing that I found kind of strange:
char *s = "Hi there";
That statement works just fine (no errors), but when I try to do this:
*s = 0;
it will give me a segmentation fault...
...in the string, I would want to convert those two characters into the single character that they represent, so I increment ti by one more.
/* unescape: copy string t to s, changing newline and tab escape sequences into
newlines and tabs, returns index of string-terminating '\0' in s[]...
I am learning C now (using a book), after learning Pascal and Visual BASIC. (by taking classes on them) I'm wondering, is it normal to change the loop control variable of a for loop (in C) inside the loop? Is it generally considered bad style? Or, are there just certain situations where it is...
Does anyone here know of a good web-page that explains floating point numbers, and how they are stored, well? I just realized that I have absolutely no idea how they work, when I had started thinking about how I would be able to compute the range of them. =) (Yes, I know there's stuff in...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.