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

    Can anyone help me out? I wrote test server/client programs to see how send and recv worked, and they work how I'd expect them to. (when trying to send() a large packet, it will only send part of it) However, if I try to use telnet/internet explorer as the client instead, send() will send a...
  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

    &quot;An array name in an expression is treated by the compiler 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...
  9. Strogian

    sizeof

    Oh Lim, I think 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...
  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

    Does anyone know exactly what happens when you define an array? I'm asking this, because (in Linux) I don't always get Segmentation Faults, when I would normally expect one. For example: char s[25]; s[400] = 0; s[-5] = 0; With that, I don't think that I got any errors running the program. I...
  17. Strogian

    Changing LCV in a For loop

    Here's an example of something that I wrote, to convert escape sequences in a string into the characters they represent. In the for loop, I stop whenever t[ti] != '\0'. Usually it will just increment ti by one at the end of an iteration, but if there is an escape sequence (&quot;\t&quot; or...
  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