print IP number from received UDP packet


hi there, I have a working UDP server in c++, how to I print the IP of the received packet\t...
Posted On: Monday 26th of November 2012 12:45:14 AM Total Views:  188
View Complete with Replies

RELATED TOPICS OF C Language PROGRAMMING LANGUAGE




ISO deprecation [was "sprintf equivalent in c++"]

James Kanze wrote: > On Oct 16, 11:28 pm, Gennaro Prota wrote: >> Pete Becker wrote: > >> [C headers] > >>>> They're long since deprecated. > >>> That is true. It is also irrelevant: they're not going to go >>> away, despite the wishes of some people early in the >>> standardization effort. > >> Can't deprecation be "canceled" under ISO rules > > In theory, or in practice. In practice, each version of the > standard is a new standard, and can make any changes it wants. I see. You imply that, in theory, it couldn't be canceled Or that it would require some long workflow [...] >> I'm far from sure but perhaps that's called "reinstatement" >> (even if the feature hasn't been removed yet). Another >> candidate for this would be strstream. > > "Deprecate" already has a negative prefix; the opposite would be > precate, or perhaps since we're restoring a previous status, > reprecate. Don't look for those words in the dictionary, > however:-). > > (The word actually derives directly from a Latin word, which > meant to pray against. [...]) Yes, I know the etymology (BTW, terms of direct Latin derivation tend to be almost homographs to the Italian ones; and usually the Italian term is also the one used colloquially). But I was thinking of ISO terminology. I guessed there was some companion document to with definitions of the basic terms. In fact I must have read "reinstatement" in some ISO-related document somewhere. (Of course, "precate" would mean "to pray (for)", which isn't what the committee wants to express, either :-)) -- Gennaro Prota | name.surname yahoo.com Breeze C++ (preview): Do you need expertise in C++ I'm available.
VIEWS ON THIS POST

114

Posted on:

Wednesday 7th November 2012
View Replies!

Monitoring print job

. Monitoring a print job with all information Windows printer queue serves is no issue. But If I print a page the page is sent from te spooler to the printer. As soon as the spooler has no more data, it reports "print ok" although the printer has a paper jam for example. Does anyone know a generic interface how to control the status of printers (not manufacturer specific)
VIEWS ON THIS POST

246

Posted on:

Wednesday 7th November 2012
View Replies!

Re: print line 3 of a file when current line is 7

dalu.gelu@gmail.com wrote: > I need to find a pattern in a file, once I find that pattern I need to > print 3 lines before to the current line containing the pattern. > > Please help me how to solve this problem in c++. I am using getline() > but not getting any back pointer for prrevious lines. Keep an array of the last several lines. deque lines( 5 ); ifstream file( "whatever" ); while ( getline( file, lines.back() ) ) { if ( lines.back() == "pattern" ) { // you have your lines. } lines.pop_front(); lines.push_back( string() ); }
VIEWS ON THIS POST

187

Posted on:

Wednesday 7th November 2012
View Replies!

sprintf for utf8 formated characters

Anyone know if the standard sprintf supports utf8 characters that extend beyond the normal ascii characters
VIEWS ON THIS POST

245

Posted on:

Wednesday 7th November 2012
View Replies!

Access overrun in BCB2006 printf

For the following code (compiled as C++): #include int main() { printf("%.40s", "test"); return 0; } CodeGuard reports: Access overrun in process: Project1.exe(3664) Attempt to access 40 byte(s) at 0x004020AA, that is at offset 6 in block 0x004020A4(=Project1.exe:0x02:0000A4) which is only 11 bytes long. 0x32757058 Call to [via 0x0040149E] printf(0x004020A4 ["%.40s"], 0x004020AA ["test"], ...) However the code appears to work correctly, even if I change the specifier to %.400000000s , which suggests that printf is not *actually* trying to read that many bytes, even though CodeGuard says that it is.
VIEWS ON THIS POST

83

Posted on:

Wednesday 7th November 2012
View Replies!

simple question abt printf

here is the program i am trying to run #include #include main() { int i; i=1; printf("%f\n",i); getchar(); } this prints the value as 0.0000 so how the printf works type casting resolves the issue
VIEWS ON THIS POST

261

Posted on:

Wednesday 7th November 2012
View Replies!

DBX print constants

I'm working with a library that contains many constants. These constants are defined using the #define preprocessor directive. I'm debugging a program. Is there a way to print out the value of the constants It would be much easier to print them out using DBX rather than looking them up in various .h files. For example, this is what I would like to do (dbx) stop at fruit.cpp:34 (dbx) run switch (fruit_type) { (dbx) print fruit_type fruit_type = 34 (dbx) print STRAWBERRY_TYPE STRAWBERRY_TYPE = 42 Here's what really happens: dbx: "STRAWBERRY_TYPE" is not defined in the scope `fruit`fruit.cpp`main:34` Now of course the names have all been changed to protect the innocent, but the problem is that I don't want to dig through .h files and documentation to find out what the various constants are equal to. (And they may change from one version of the library to the next anyway.)
VIEWS ON THIS POST

70

Posted on:

Wednesday 7th November 2012
View Replies!

doubles/printf & rounding

Is there a way to prevent rounding when using printf for print a double/float Example: double x=3.51; printf("%.0f\n", x); The output of this is 4, when I want it to be 3. I've been surfing the net but I've been coming up empty. Big
VIEWS ON THIS POST

112

Posted on:

Wednesday 7th November 2012
View Replies!

How to make std::string behave like sprintf

Hi all. When I use sprintf, it is ieasy to print a number to a char array: int i= 1; char s1[100]; sprintf(s1,"Number %d\0",i); How does one achieve the same using std::string instead of char[] I have scanned chapter 20 of Stroustrup's 3ed but can't find anything obviously useful. Rune -- [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ]
VIEWS ON THIS POST

116

Posted on:

Wednesday 7th November 2012
View Replies!

A problem about print an unsigned int

I wrote the following code: int main() { int x1 = 1000 ; unsigned int x2 = 1000 ; printf("x1 = %d (0x%x), x2 = %d (0x%x).\n", x1, x2) ; printf("x2 = %d (0x%x).\n", x2) ; return 0 ; } and complied and linked it respectively with VC++ and gcc. Both the running results suprised me greatly. For the VC++ version, the running result is: x1 = 1000 (0x3e8), x2 = 2367460 (0x12f7bc). x2 = 1000 (0x241fe4). For the gcc version, the running result is: x1 = 1000 (0x3e8), x2 = 134513626 (0xcd6ff4). x2 = 1000 (0x3e8). Here are my questions: 1) Why "x2" was NOT printed as "1000" at the first printf statement 2) At the second printf statement, why 'x2' was printed as "0x241fe4" with the directives "0x%x" in the VC++ version, while "0x3e8" in the gcc version
VIEWS ON THIS POST

124

Posted on:

Wednesday 7th November 2012
View Replies!

How to print output into a different terminal ?

I have a c++ program in which i have 4 different entities(think as virtual threads) having uniique ids (0 to 3) and I would like to open 4 different terminals (xterm windows) from within the program and output the prints from these 4 different entities into their respective xterm windows and close the windows when the program exits, but am not sure how to do it. I have tried to find some help through google search but didn't land up with anything helpful... any help would be great...
VIEWS ON THIS POST

91

Posted on:

Wednesday 7th November 2012
View Replies!

Re: doubles/printf & rounding

On Sep 5, 5:22 am, wombat <6...@k.com> wrote: > Is there a way to prevent rounding when using printf for print a > double/float > Example: > double x=3.51; > printf("%.0f\n", x); > The output of this is 4, when ...
VIEWS ON THIS POST

100

Posted on:

Saturday 10th November 2012
View Replies!

Re: sprintf equivalent in c++

u can use ostream ostream out; out << "something here"; more info: http://www.cplusplus.com/reference/iostream/ostream/ --------------= Posted using GrabIt =---------------- ------= Binary Usenet downloading made easy =--------- -= Get GrabIt for free from http://www.shemes.com/ =-...
VIEWS ON THIS POST

147

Posted on:

Saturday 10th November 2012
View Replies!

printing doubles and robustness of setw()

Dear all, On a formatted printing operation that I am trying to accomplish for doubles, I have a question. I would like to print a double, d, and its square, d*d, but I would like to make the argument to ...
VIEWS ON THIS POST

108

Posted on:

Sunday 11th November 2012
View Replies!

Output to a printer

I'm having a problem getting a program to print to my inkjet. I've tried addressing with lpt1, PRN and even USB001. It just doesn't seem to find it's way to the printer. Here's the code: #include #include ...
VIEWS ON THIS POST

32

Posted on:

Sunday 11th November 2012
View Replies!

printf hacking

Hi I have a function as below void print(char* str) { printf(str); } now the user of the function can pass anything as the argument for print(). I am looking got major security issues with this fucntion. I mean can ...
VIEWS ON THIS POST

62

Posted on:

Sunday 11th November 2012
View Replies!

Code to print each part of double as a separate group of bits

As in IEEE754 double consist of sign bit 11 bits for exponent 52 bits for fraction i write this code to print double parts as it explained in ieee754 i want to know if the code contain any bug , ...
VIEWS ON THIS POST

59

Posted on:

Sunday 11th November 2012
View Replies!

printint problem

I'm trying to print out barcodes within my program using Code128B fonts The code is something as follows: strDocID = CalculateCheckSum(strDocID); CRect rectBarcode = PrintText(pDC, rectFolder.bottom+m_nTextSpacing * 10, rect, strDocID, ALIGN_CENTER); CString PrintContainerLabel::CalculateCheckSum(CString barcode) { int checkSum; CString Code128b; char ...
VIEWS ON THIS POST

85

Posted on:

Sunday 11th November 2012
View Replies!

Disabling printf, enabling something else

, We have a code with lot of printfs. Now I would like to introduce special mode, in which only special messages are displayed and all other are hidden. No macros or replacements please. I'm looking for good looking in ...
VIEWS ON THIS POST

72

Posted on:

Sunday 25th November 2012
View Replies!

printing the union (help)

I am doing a program of overloaded methods. I want to get what is the union of the user set and S set and the user set and S1 set. I try it but it is not working. Can ...
VIEWS ON THIS POST

127

Posted on:

Sunday 25th November 2012
View Replies!