Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  1. Strogian

    Packet Filtering

    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...
  2. Strogian

    send() sending huge packets

    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?
  3. Strogian

    send() sending huge packets

    ...= htons(PORT); addr.sin_addr.s_addr = INADDR_ANY; memset(addr.sin_zero, 0, sizeof addr.sin_zero); if (bind(sockfd, (struct sockaddr *) &addr, sizeof addr) == -1) { perror("bind"); return 1; } if (listen(sockfd, 5) == -1) { perror("listen"); return...
  4. Strogian

    How to identify a CR and LF

    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...
  5. Strogian

    Don't know what's causing this bug

    Nevermind, I figured it out. =) (I didn't declare ld as a long double in main(), and I needed to use %Lf for it, not %lf)
  6. Strogian

    Don't know what's causing this bug

    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[] = &quot;The quick brown fox jumps over the lazy dog.&quot...
  7. Strogian

    How to identify a CR and LF

    What about '\n'? Doesn't C change (depending on the OS) CR/LF to a '\n'?
  8. Strogian

    sizeof

    ...as a pointer to the first element of the array&quot; 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?)
  9. Strogian

    sizeof

    ...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(&quot;Hi&quot;); That is one of those things that I never REALLY understood, but I'm guessing that I...
  10. Strogian

    sizeof

    It actually returns the allocated memory under it. Here's the output of several times running the program: 271 271 318 318 341 341
  11. Strogian

    sizeof

    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...
  12. Strogian

    keyboard buffer problem

    Please, don't do that, Stress_Daddy. It can be done, but it would really be invading his privacy, IMHO.
  13. Strogian

    Arrays, pointers, and Segmentation Faults

    Are you saying that, when I define some array, it puts that array somewhere in the middle of some special &quot;read/write&quot; 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?
  14. Strogian

    Arrays, pointers, and Segmentation Faults

    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 &quot;Hi there&quot;, but cannot modify it...
  15. Strogian

    Arrays, pointers, and Segmentation Faults

    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]...
  16. Strogian

    Arrays, pointers, and Segmentation Faults

    ...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 = &quot;Hi there&quot;; That statement works just fine (no errors), but when I try to do this: *s = 0; it will give me a segmentation fault...
  17. Strogian

    Changing LCV in a For loop

    ...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[]...
  18. Strogian

    Changing LCV in a For loop

    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...
  19. Strogian

    Floating point numbers

    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...
  20. Strogian

    for loop without statement

    Ohhhhhhhh okay! (I was actually starting to wonder if I needed to do something like that) Thank you!

Part and Inventory Search

Back
Top