Thread: [Dev-C++] Re: Dev-cpp-users digest, Vol 1 #2061 - 6 msgs
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Ehi I. <eh...@ya...> - 2004-07-15 08:26:19
|
Hi Gs, Two weeks ago, I asked for links to Winsock programming tutorials. I got several responses, and I checked them out. These are the ones I currently found really helpful: http://www.ecst.csuchico.edu/~beej/guide/net/ http://www.hal-pc.org/~johnnie2/winsock.html The other links I got a still very relevant. I have learnt that there is also UNIX network programming, and that network programming isn't as daunting as I thought it was. Thanks guys for the help. Ehi Ikhimiukor dev...@li... wrote: Send Dev-cpp-users mailing list submissions to dev...@li... To subscribe or unsubscribe via the World Wide Web, visit https://lists.sourceforge.net/lists/listinfo/dev-cpp-users or, via email, send a message with subject or body 'help' to dev...@li... You can reach the person managing the list at dev...@li... When replying, please edit your Subject line so it is more specific than "Re: Contents of Dev-cpp-users digest..." Today's Topics: 1. Access Violation (Segmentation Fault) (Kenneth P. Ruppel) 2. Re: How to do WinSock programming (Ehi Ikhimiukor) 3. Re: Re: How to do WinSock programming (A. Klingenstein) 4. Re: Re: How to do WinSock programming (Gary Lawton) 5. Re: Re: How to do WinSock programming (Jesse Hallam) 6. Re: Re: How to do WinSock programming (David McKen) --__--__-- Message: 1 Date: Sun, 27 Jun 2004 02:53:44 -0400 From: "Kenneth P. Ruppel" To: Dev-C Mailing List Subject: [Dev-C++] Access Violation (Segmentation Fault) When I debug this program, I get "Warning: An Access Violation (Segmentation Fault) raised in your program." When I get this error msg, I end up in stl_construct.h. ---------------------------------------------------------------------------------------------------------------------------- int Range=0; int PreviousRange=0; vector Groupset; // subscripts/pointers to Groupset ranges ofstream DGroupset("W:\\AAAnalysis\\DGroupset.txt"); ofstream DWDRlist("W:\\AAAnalysis\\DWDRlist.txt"); .... int main() { .... if (Mtglist[i].substr(0,1) == "*") { if (Mtglist[i].size() == 8) { Groupset.push_back(Range); <=======================> Here's the stmt that yields the error. DGroupset << Range << endl; DWDRlist << Mtglist[i] << endl; PreviousRange=Range; TWDR++; } } ----------------------------------------------------------------------------------------------------------------------------- I know that you always want to see the entire program, but it is over 300 lines long, so please let's see if anyone can see anything glaringly wrong with this, okay? At the moment of error, Range = a valid integer. DGroupset is merely a disk image of the vector so I can see what's going on. I have checked if "Range" is a reserved word (it is not). I have checked if a vector needs any special handling (it does not). I have chkdsk'ed the partition. What could cause this? What are some causes a Segmentation Fault? TIA, Ken --__--__-- Message: 2 Date: Sun, 27 Jun 2004 02:15:25 -0700 (PDT) From: Ehi Ikhimiukor To: dev...@li... Subject: [Dev-C++] Re: How to do WinSock programming --0-1278108441-1088327725=:45481 Content-Type: text/plain; charset=us-ascii Hello Gs, Thanks David McKen for the reply. I appreciate it. But I gotta admit, I am a beginner programmer. Could any one give me a link to a tutorial on WinSock Programming. Thanks. dev...@li... wrote: Send Dev-cpp-users mailing list submissions to dev...@li... To subscribe or unsubscribe via the World Wide Web, visit https://lists.sourceforge.net/lists/listinfo/dev-cpp-users or, via email, send a message with subject or body 'help' to dev...@li... You can reach the person managing the list at dev...@li... When replying, please edit your Subject line so it is more specific than "Re: Contents of Dev-cpp-users digest..." Today's Topics: 1. Re: dev-cpp-4.9.9.0 (sp...@po...) 2. RE: file handling (Scott Simontis) 3. Re: How to do WinSock programming (David McKen) -- __--__-- Message: 1 Date: Sat, 26 Jun 2004 10:40:55 -0400 From: "sp...@po..." To: dev...@li... Subject: Re: [Dev-C++] dev-cpp-4.9.9.0 Guillermo Gutierrez wrote: > /Any idea when the next version w/ the latest MinGW in the installer > will be available?/ > I'm in process of creating easy upgradeable mingw packages. I can also make an alpha 4.9.9.0 if you're interested (most likely sometime this weekend). Marek Januszewski -- __--__-- Message: 2 From: "Scott Simontis" To: "'Marco Ribeiro'" , "'Eric'" Cc: Subject: RE: [Dev-C++] file handling Date: Sat, 26 Jun 2004 11:28:21 -0400 This might be a helpful link for some people: http://www.catb.org/~esr/faqs/smart-questions.html -----Original Message----- From: dev...@li... [mailto:dev...@li...] On Behalf Of Marco Ribeiro Sent: Wednesday, June 30, 2004 9:22 AM To: 'Eric' Cc: dev...@li... Subject: RE: [Dev-C++] file handling Sorry Eric, but I think the propose of this mailing list is not that. I mean, my idea of it is every one should try to help the way it's = possible. Well I have always two options: 1) Try to Help 2) See the mail and not help (even if I know the answer or at least a = clue for it) But the best part is this ;) You have two options too: 1) See the mail and go to the link 2) See the mail and discard ;)=20 Well but I understand your point, so here is the text you would find in = that page: NOTE: I DID A COPY PASTE OF THE PAGE, SOME LINES MIGHT BE IN DIFFERENT ORDER!!!!=20 Hope it helps...=20 C++ Notes: Reading Text Files Reading a text file is very easy using an ifstream (input file stream).=20 Include the necessary headers.=20 #include using namespace std; Declare an input file stream (ifstream) variable. For example,=20 ifstream inFile; Open the file stream. Path names in MS Windows use backslashes (\). = Because the backslash is also the string escape character, it must be doubled. = If the full path is not given, most systems will look in the directory that contains the object program. For example,=20 inFile.open("C:\\temp\\datafile.txt"); Check that the file was opened. For example, the open fails if the file doesn't exist, or if it can't be read because another program is writing = it. A failure can be detected with code like that below using the ! (logical not) operator:=20 if (!inFile) { cerr << "Unable to open file datafile.txt"; exit(1); // call system to stop } Read from the stream in the same way as cin. For example,=20 while (inFile >> x) { sum =3D sum + x; } Close the input stream. Closing is essential for output streams to be = sure all information has been written to the disk, but is also good practice = for input streams to release system resources and make the file available = for other programs that might need to write it.=20 inFile.close(); Example The following program reads integers from a file and prints their sum. = 1=20 2=20 3=20 4=20 5=20 6=20 7=20 8=20 9=20 10=20 11=20 12=20 13=20 14=20 15=20 16=20 17=20 18=20 19=20 20=20 21=20 22=20 23=20 24=20 25=20 26=20 27=20 // io/read-file-sum.cpp - Read integers from file and print sum. // Fred Swartz 2003-08-20 #include #include #include using namespace std; int main() { int sum =3D 0; int x; ifstream inFile; =20 inFile.open("test.txt"); if (!inFile) { cout << "Unable to open file"; exit(1); // terminate with error } =20 while (inFile >> x) { sum =3D sum + x; } =20 inFile.close(); cout << "Sum =3D " << sum << endl;=20 return 0; } The text from the above example can be selected, copied, and pasted into = an editor. =20 Copyleft 2000-3 Fred Swartz Last update 2003-09-25, URL=3Dundefined -----Original Message----- From: Eric [mailto:eri...@cl...]=20 Sent: s=E1bado, 26 de Junho de 2004 10:17 To: Marco Ribeiro; 'Noorez Kassam' Cc: dev...@li... Subject: Re: [Dev-C++] file handling COULD YOU NOT INCLUDE THE PAGE WITHIN THE EMAIL SOME PEOPLE LOG ON, GET THE EMAIL AND LOG OFF. IT IS VERY ANNOYING WHEN YOU "GO TO THIS URL TO FIND YOUR ANSWER" THANKS FROM ERIC ----- Original Message ----- From: "Marco Ribeiro" To: "'Noorez Kassam'" Cc: Sent: Wednesday, June 30, 2004 11:48 AM Subject: RE: [Dev-C++] file handling Sorry about the last post :) The link http://www.fredosaurus.com/notes-cpp/io/readtextfile.html bye. Marco -----Original Message----- From: dev...@li... [mailto:dev...@li...] On Behalf Of Noorez Kassam Sent: sexta-feira, 25 de Junho de 2004 22:09 To: dev...@li... Subject: [Dev-C++] file handling How can I get integers from a file. The get() method only seems to work with chars. _________________________________________________________________ STOP MORE SPAM with the MSN Premium and get 2 months FREE* http://join.msn.com/?pgmarket=3Den-ca&page=3Dbyoa/prem&xAPID=3D1994&DI=3D= 1034&SU =3Dhtt p://hotmail.com/enca&HL=3DMarket_MSNIS_Taglines ------------------------------------------------------- This SF.Net email sponsored by Black Hat Briefings & Training. Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com _______________________________________________ Dev-cpp-users mailing list Dev...@li... TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm https://lists.sourceforge.net/lists/listinfo/dev-cpp-users ------------------------------------------------------- This SF.Net email sponsored by Black Hat Briefings & Training. Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com _______________________________________________ Dev-cpp-users mailing list Dev...@li... TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm https://lists.sourceforge.net/lists/listinfo/dev-cpp-users --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.710 / Virus Database: 466 - Release Date: 23-Jun-04 ------------------------------------------------------- This SF.Net email sponsored by Black Hat Briefings & Training. Attend Black Hat Briefings & Training, Las Vegas July 24-29 -=20 digital self defense, top technical experts, no vendor pitches,=20 unmatched networking opportunities. Visit www.blackhat.com _______________________________________________ Dev-cpp-users mailing list Dev...@li... TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm https://lists.sourceforge.net/lists/listinfo/dev-cpp-users -- __--__-- Message: 3 Date: Sat, 26 Jun 2004 17:41:32 -0400 From: David McKen To: "Mailing List, Dev-Cpp" Subject: Re: [Dev-C++] How to do WinSock programming Exactly the same. What changes is how you compile the program. Instead of adding WS2_32.LIB/WSOCK32.LIB you add -lws2_32/-lwsock32 to your linker command line. The includes, structures & functions all stay the same (the libraries also stay the same but they have slightly different file names) Ehi Ikhimiukor wrote: > Hi guys, > Can someone please tell me how to do WinSock programming with Dev C++? I > know Visual C++ syntax, but I am not sure of Dev C++'s syntax for doing > that kind of programming. Thanks. > > Ehi Ikhimiukor > > ------------------------------------------------------------------------ > Do you Yahoo!? > Yahoo! Mail > > - 50x more storage than other providers! -- __--__-- _______________________________________________ Dev-cpp-users mailing list Dev...@li... TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm https://lists.sourceforge.net/lists/listinfo/dev-cpp-users End of Dev-cpp-users Digest --------------------------------- Do you Yahoo!? Yahoo! Mail is new and improved - Check it out! --0-1278108441-1088327725=:45481 Content-Type: text/html; charset=us-ascii Hello Gs, Thanks David McKen for the reply. I appreciate it. But I gotta admit, I am a beginner programmer. Could any one give me a link to a tutorial on WinSock Programming. Thanks. dev...@li... wrote: Send Dev-cpp-users mailing list submissions to dev...@li... To subscribe or unsubscribe via the World Wide Web, visit https://lists.sourceforge.net/lists/listinfo/dev-cpp-users or, via email, send a message with subject or body 'help' to dev...@li... You can reach the person managing the list at dev...@li... When replying, please edit your Subject line so it is more specific than "Re: Contents of Dev-cpp-users digest..." Today's Topics: 1. Re: dev-cpp-4.9.9.0 (sp...@po...) 2. RE: file handling (Scott Simontis) 3. Re: How to do WinSock programming (David McKen) -- __--__-- Message: 1 Date: Sat, 26 Jun 2004 10:40:55 -0400 From: "sp...@po..." To: dev...@li... Subject: Re: [Dev-C++] dev-cpp-4.9.9.0 Guillermo Gutierrez wrote: > /Any idea when the next version w/ the latest MinGW in the installer > will be available?/ > I'm in process of creating easy upgradeable mingw packages. I can also make an alpha 4.9.9.0 if you're interested (most likely sometime this weekend). Marek Januszewski -- __--__-- Message: 2 From: "Scott Simontis" To: "'Marco Ribeiro'" , "'Eric'" Cc: Subject: RE: [Dev-C++] file handling Date: Sat, 26 Jun 2004 11:28:21 -0400 This might be a helpful link for some people: http://www.catb.org/~esr/faqs/smart-questions.html -----Original Message----- From: dev...@li... [mailto:dev...@li...] On Behalf Of Marco Ribeiro Sent: Wednesday, June 30, 2004 9:22 AM To: 'Eric' Cc: dev...@li... Subject: RE: [Dev-C++] file handling Sorry Eric, but I think the propose of this mailing list is not that. I mean, my idea of it is every one should try to help the way it's = possible. Well I have always two options: 1) Try to Help 2) See the mail and not help (even if I know the answer or at least a = clue for it) But the best part is this ;) You have two options too: 1) See the mail and go to the link 2) See the mail and discard ;)=20 Well but I understand your point, so here is the text you would find in = that page: NOTE: I DID A COPY PASTE OF THE PAGE, SOME LINES MIGHT BE IN DIFFERENT ORDER!!!!=20 Hope it helps...=20 C++ Notes: Reading Text Files Reading a text file is very easy using an ifstream (input file stream).=20 Include the necessary headers.=20 #incl ude using namespace std; Declare an input file stream (ifstream) variable. For example,=20 ifstream inFile; Open the file stream. Path names in MS Windows use backslashes (\). = Because the backslash is also the string escape character, it must be doubled. = If the full path is not given, most systems will look in the directory that contains the object program. For example,=20 inFile.open("C:\\temp\\datafile.txt"); Check that the file was opened. For example, the open fails if the file doesn't exist, or if it can't be read because another program is writing = it. A failure can be detected with code like that below using the ! (logical not) operator:=20 if (!inFile) { cerr << "Unable to open file datafile.txt"; exit(1); // call system to stop } Read from the stream in the same way as cin. For example,=20 while (inFile >> x) { sum =3D sum + x; } Close the input stream. Closing is essentia l for output streams to be = sure all information has been written to the disk, but is also good practice = for input streams to release system resources and make the file available = for other programs that might need to write it.=20 inFile.close(); Example The following program reads integers from a file and prints their sum. = 1=20 2=20 3=20 4=20 5=20 6=20 7=20 8=20 9=20 10=20 11=20 12=20 13=20 14=20 15=20 16=20 17=20 18=20 19=20 20=20 21=20 22=20 23=20 24=20 25=20 26=20 27=20 // io/read-file-sum.cpp - Read integers from file and print sum. // Fred Swartz 2003-08-20 #include #include #include using namespace std; int main() { int sum =3D 0; int x; ifstream inFile; =20 inFile.open("test.txt"); if (!inFile) { cout << "Unable to open file"; exit(1); // terminate with error } =20 while (inFile >> x) { sum =3D sum + x; } =20 inFile.close(); cout << "Sum =3D " << sum << endl;=20 return 0; } The text from the above example can be selected, copied, and pasted into = an editor. =20 Copyleft 2000-3 Fred Swartz Last update 2003-09-25, URL=3Dundefined -----Original Message----- From: Eric [mailto:eri...@cl...]=20 Sent: s=E1bado, 26 de Junho de 2004 10:17 To: Marco Ribeiro; 'Noorez Kassam' Cc: dev...@li... Subject: Re: [Dev-C++] file handling COULD YOU NOT INCLUDE THE PAGE WITHIN THE EMAIL SOME PEOPLE LOG ON, GET THE EMAIL AND LOG OFF. IT IS VERY ANNOYING WHEN YOU "GO TO THIS URL TO FIND YOUR ANSWER" THANKS FROM ERIC ----- Original Message ----- From: "Marco Ribeiro" To: "'Noorez Kassam'" Cc: Sent: Wednesday, June 30, 2004 11:48 AM Subject: RE: [Dev-C++] file handling Sorry about the last post :) The link http://www.fredosaurus.com/notes-cpp/io/readtextfile.html bye. Marco -----Original Message----- From: dev...@li... [mailto:dev...@li...] On Behalf Of Noorez Kassam Sent: sexta-feira, 25 de Junho de 2004 22:09 To: dev...@li... Subject: [Dev-C++] file handling How can I get integers from a file. The get() method only seems to work with chars. _________________________________________________________________ STOP MORE SPAM with the MSN Premium and get 2 months FREE* http://join.msn.com/?pgmarket=3Den-ca&page=3Dbyoa/prem&xAPID=3D1994&DI=3D= 1034&SU =3Dhtt p://hotmail.com/enca&HL=3DMarket_MSNIS_Taglines ------------------------------------------------------- This SF.Net email sponsored by Black Hat Briefings & Training. Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com _______________________________________________ Dev-cpp-users mailing list Dev...@li... TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm https://lists.sourceforge.net/lists/listinfo/dev-cpp-users ------------------------------------------------------- This SF.Net email sponsored by Black Hat Briefings & Training. Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com _______________________________________________ Dev-cpp-users mailing list Dev...@li... TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm https://lists.sourceforge.net/lists/listinfo/dev-cpp-users --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.710 / Virus Database: 466 - Release Date: 23-Jun-04 ------------------------------------------------------- This SF.Net email sponsored by Black Hat Briefings & Training. Attend Black Hat Briefings & Training, Las Vegas July 24-29 -=20 digital self defense, top technical experts, no vendor pitches,=20 unmatched networking opportunities. Visit www.blackhat.com _______________________________________________ Dev-cpp-users mailing === message truncated === --------------------------------- Do you Yahoo!? Read only the mail you want - Yahoo! Mail SpamGuard. |
|
From: David M. <dml...@co...> - 2004-07-15 13:46:50
|
One thing you should note is that programming winsock is UNIX network programming with some extra Microsoft specific additives. The BSD socket interface (UNIX network programming interface) existed long before Microsoft created winsock, the kick is winsock was designed using the BSD interface as it's basis. Ehi Ikhimiukor wrote: > Hi Gs, > Two weeks ago, I asked for links to Winsock programming tutorials. I > got several responses, and I checked them out. These are the ones I > currently found really helpful: > > http://www.ecst.csuchico.edu/~beej/guide/net/ > <http://www.ecst.csuchico.edu/%7Ebeej/guide/net/> > > http://www.hal-pc.org/~johnnie2/winsock.html > <http://www.hal-pc.org/%7Ejohnnie2/winsock.html> > The other links I got a still very relevant. I have learnt that there > is also UNIX network programming, and that network programming isn't > as daunting as I thought it was. Thanks guys for the help. |