Thread: [Dev-C++] (no subject) (Page 4)
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
From: Alex <sum...@be...> - 2001-11-12 05:07:38
|
From: <Joh...@ao...> - 2001-11-23 01:48:18
|
#include <iostream.h> #include <stdio.h> //QUESTION: Using what feature on the compiler to enter the 'argv'? void main(int argc, char** argv) { int a = 10; int b = a + argc; cout<<" b = a + argc: "<<b<<endl; int d = a + int(argv);// cout<<" d = a + argv: "<< d<<endl; getchar(); } //I enter the 'argc' through the input of 'Parameter' Button then hit //the 'Exection' to run the program. But I dont know how/where to enter the //'argv' through the command line..... Very appreciate your help.......... |
From: Jason H. <jas...@bt...> - 2001-11-23 02:36:03
|
You appear to not understand what argc and argv are. They are a standard = part of a C/C++ program with a main() function and are linked together = in thier use. When you execute a program and follow it with various = parameters, i.e.: MyProg -a 20 -b MyFile.foo then the OS breaks the string down into each of the individual words = (seperated by spaces (usuualy)) and uses both argc and argv together to = make them accessible to the program. The first argc is pretty simple, it = gives you the number of arguments passed to your program including the = string representing the executable command. So in the above example argc = would be 5. Note it depends on the OS as to how the command is broken = down (AFAIK), but usualy spaces are it, possibly with commands enclosed = in qoutes treated as one command and kept whole. The second argv is a little more complex. I hope you are OK with = pointers, because we are dealing with a pointer, to a pointer, to a = string. Or if you prefer an array of pointers to strings. Basically you = have an array of values that point to all the command strings passed. = The OS doesn't convert numbers for you (as you seem to think) it just = passes everything as strings. The above command would translate into: "MyProg", "-a", "20", "-b", "MyFile.foo" If you wanted to display the name of the program then you could use: cout << argv[0]; or cout << *argv; The array version is used more often as it is easier to understand when = seen. The fifth argument could be displayed with: cout << argv[4]; Displaying: MyFile.foo Using this method the OS can allow any kinds of arguments to be passed = into a program without worrying about what is right or wrong. It leaves = it up to you, the programmer, to detect right and wrong. Here is a simple example (untested): // Add.exe #include <iostream> #include <cstdlib> #include <cctype> int main(int argc, char *argv[]) { // make sure enough args supplied if(argc !=3D 3) { cout << "Usage: " << argv[0] << " A B" << endl; cout << "Where A and B are integers" << endl; exit(1); } // make sure both values are integers char *pch; // first arg for(pch =3D argv[1]; pch; ++pch) { if(!isdigit(*pch)) { cout << "Values must be integers!" << endl; exit(2); } } // second arg for(pch =3D argv[2]; pch; ++pch) { if(!isdigit(*pch)) { cout << "Values must be integers!" << endl; exit(2); } } // add the numbers together and output cout << argv[1] << " + " << argv[2] << " =3D "; cout << atoi(argv[1]) + atoi(argv[2]) << endl; =20 return 0; // all ok } Try compiling that, correct any syntax or other errors I may have made, = and it should when executed from a dos prompt output the sum of the two = digits supplied. If you are a newbie then I don't expect you to understand all that I did = in that. I'm a bit lazy and didn't want to write it in a way that was = easier to read to someone not used to pointers etc... (I hope it works = now). I hope this helps, Jason. PS: when I say strings I was refering to the C style of null terminated = array of chars, and not the container class in C++. ----- Original Message -----=20 From: Joh...@ao...=20 To: dev...@li...=20 Sent: Friday, November 23, 2001 1:46 AM Subject: [Dev-C++] (no subject) #include <iostream.h> #include <stdio.h> //QUESTION: Using what feature on the compiler to enter the 'argv'? void main(int argc, char** argv) { int a =3D 10; int b =3D a + argc; cout<<" b =3D a + argc: "<<b<<endl; int d =3D a + int(argv);// cout<<" d =3D a + argv: "<< d<<endl; getchar(); } //I enter the 'argc' through the input of 'Parameter' Button then hit //the 'Exection' to run the program. But I dont know how/where to = enter the //'argv' through the command line..... Very appreciate your help..........=20 |
From: Ioannis V. <no...@ya...> - 2001-11-23 04:48:42
|
argv is an array of C-string pointers which has stored the arguments given in command line. argv[0] is the name of the program itself. argc is the number of argv elements and is at least 1 (the name of the executable). **argv is also *argv[]. The second is the more notationally correct (because argv is an array of c-strings). So here is some ANSI C++ 1998 code demonstrating this: =20 =20 #include <iostream> #include <cstdio> =20 int main(int argc, char *argv[]) { using namespace std; =20 cout<<"The total number of arguments including the filename of the program,\nargc: "<<argc<<endl; =20 cout<<"\nAnd now the arguments only:\n"; =20 for(int i=3D1; i<argc; i++) cout<<argv[i]<<" "; =20 cout<<endl; =20 getchar(); } =20 How i executed it: =20 C:\c>temp 1 test The total number of arguments including the filename of the program, argc: 3 =20 And now the arguments only: 1 test =20 =20 =20 Hope you got it. =20 =20 Ioannis =20 * Ioannis Vranos * Programming pages: http://www.noicys.f2s.com <http://www.noicys.f2s.com/>=20 * Alternative URL: http://run.to/noicys =20 =20 -----Original Message----- From: dev...@li... [mailto:dev...@li...] On Behalf Of Joh...@ao... Sent: Friday, November 23, 2001 3:47 AM To: dev...@li... Subject: [Dev-C++] (no subject) #include <iostream.h> #include <stdio.h> //QUESTION: Using what feature on the compiler to enter the 'argv'? void main(int argc, char** argv) { int a =3D 10; int b =3D a + argc; cout<<" b =3D a + argc: "<<b<<endl; int d =3D a + int(argv);// cout<<" d =3D a + argv: "<< d<<endl; getchar(); } //I enter the 'argc' through the input of 'Parameter' Button then hit //the 'Exection' to run the program. But I dont know how/where to enter the //'argv' through the command line..... Very appreciate your help..........=20 |
From: Christian W. <Chr...@vo...> - 2001-12-05 15:07:39
|
Hi List, I want to sent an UDP Datagram via TCP... The send and recive function works properly in a console app... Now i want to make a GUI for that... The problem is that the editfield in my application is a cstring (m_Edit1), but my app needs a nullterminated string... If I convert the CString to a nullterminated string I get nothing ... If I write strcpy(szSendString, "hjsdfhs\0"); it works .... I have many things tryed but nothing work... Did you have an Idea ??? What can I do ? Kind regrads Christian |
From: Jason H. <jas...@bt...> - 2001-12-05 19:32:14
|
When you refer to CString are you talking about a class of some kind or are you mixing up the C++ class String with a c "style" string? A c style string is in fact a null terminated string, and when you write "Hello World!" (note no need for \0) you are just declaring a null terminated string. If you are useing the C++ String class then to use it as a C string you have to use it's member function c_str(); which returns a pointer to a temporary c style string. Note that you shouldn't try to modify the string through this function. Regards, Jason. ----- Original Message ----- From: "Christian Wallukat" <Chr...@vo...> To: "CPP-Maillinglist (E-Mail)" <dev...@li...> Sent: Wednesday, December 05, 2001 3:09 PM Subject: [Dev-C++] (no subject) > Hi List, > > > I want to sent an UDP Datagram via TCP... > > The send and recive function works properly in a console app... > > Now i want to make a GUI for that... > > > > The problem is that the editfield in my application is a cstring (m_Edit1), > but my app needs a nullterminated string... > > If I convert the CString to a nullterminated string I get nothing ... > > If I write strcpy(szSendString, "hjsdfhs\0"); it works .... > > > > > I have many things tryed but nothing work... > > > Did you have an Idea ??? > > What can I do ? > > > > > Kind regrads > > > Christian > > > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users |
From: Kevin W. <ke...@me...> - 2001-12-06 01:06:57
|
I notice the style of the member variable, are you using MS Visual C++ ? If so, and the CString is a MS Foundation Classes CString, you use either m_Edit1.getBuffer( ) or cast the CString to a const char* : (const char*)m_Edit1 both of which return a pointer to a null-terminated character string. Kev. ----- Original Message ----- From: Christian Wallukat <Chr...@vo...> To: CPP-Maillinglist (E-Mail) <dev...@li...> Sent: Wednesday, December 05, 2001 3:09 PM Subject: [Dev-C++] (no subject) > Hi List, > > > I want to sent an UDP Datagram via TCP... > > The send and recive function works properly in a console app... > > Now i want to make a GUI for that... > > > > The problem is that the editfield in my application is a cstring (m_Edit1), > but my app needs a nullterminated string... > > If I convert the CString to a nullterminated string I get nothing ... > > If I write strcpy(szSendString, "hjsdfhs\0"); it works .... > > > > > I have many things tryed but nothing work... > > > Did you have an Idea ??? > > What can I do ? > > > > > Kind regrads > > > Christian > > > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users > |
From: Nirmit K. <nir...@ho...> - 2001-12-11 14:48:17
|
RESPECTED SIR/ MADAM, Please remove me from the mailing list coz of some reasons which are unexplanatory. Please take this e-mail seriously and remove me from the mailing list. Nirmit Kumar _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp |
From: Andre` N. C. <An...@Ax...> - 2002-01-08 18:47:56
|
battle.c:8: warning: implicit declaration of function `int titleshot(...)= ' Any CLUE what this might mean? Regards, Andr=E9 C. Technical Support =D4=BF=D4=AC -------------------------------------------------------------------------= --- - Visit our support manual at http://supportmanual.com/ |
From: Joshua T. <vap...@ms...> - 2002-01-08 20:28:11
|
I have tried to use the two following statments =20 cout.setf(ios::boolalpha); // or cout.setf(ios_base::boolalpha); =20 The first gives me the compiler errer " boolalpha is not a member of ios"= and the second says "unable to access ios_base", I have not changed any = of my default paths for liabaries, so how would I fix the error. I have u= sed ios members in the past... =20 Thanks ahead of time, Joshua T.Get more from the Web. FREE MSN Explorer download : http://expl= orer.msn.com |
From: Clovis S. <cs...@it...> - 2002-01-09 20:51:10
|
Hi, I am having some compiler errors with this line: line 183 - /* ***** TELA TRES -- cadastro clientes ---------- */ the compiler output is: 183 teste8.cpp parse error at end of input As it is just a comment i have no idea of what is wrong here. Does anyone?? ps: this is the last line of this program. thanks. ------------------------------------------------- Clovis Sena Itautec.Com Servicos Suporte Tecnico Software/Hardware --------------- Email: cs...@it... Fone : 0xx81-3421-1126 Fax : 0xx81-3421-4988 ------------------------------------------------- |
From: Shadow <rh...@th...> - 2002-01-10 16:28:03
|
This email was delivered to you by The Free Internet. http://www.thefreeinternet.net --------------------------------------------------------------- |
From: Chris H. <fie...@ya...> - 2002-01-12 14:47:00
|
Hi, Not sure whether I sent this already or not, but every time I use a common function (InitCommonControls(), PropertySheet(), etc...), I receive an undefined reference to the function in my linker error msg box. Does anyone know why this could be? Please reply with info, thanks. Fierytycoon --------------------------------- Do You Yahoo!? Send FREE video emails in Yahoo! Mail. |
From: bouba t. <bou...@ho...> - 2002-01-18 18:46:16
|
confirm 421200 _________________________________________________________________ Chat with friends online, try MSN Messenger: http://messenger.msn.com |
From: David M. <ci...@ya...> - 2002-01-19 21:01:41
|
I know this might be a bit off the subject but I would like to take full control of a serial port. I plan to use it to control a simple robot. does anyone know of a library that would allow me to take control of the robot? (when I say low level, I mean low level. For now the robot will only move if it receives a signal on a certain line. There is no need for error correction) _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com |
From: David M. <ci...@ya...> - 2002-01-19 21:07:51
|
I know this might be a bit off the subject but I would like to take full control of a serial port. I plan to use it to control a simple robot. does anyone know of a library that would allow me to take control of the robot? (when I say low level, I mean low level. For now the robot will only move if it receives a signal on a certain line. There is no need for error correction) _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com |
From: mc.navar <mc....@gm...> - 2002-01-19 21:55:15
|
hi david, check the followingen pages. I find them very usefull. I work at the same problem but I use the more easier parallel port. mc. http://www.epanorama.net/links/motorcontrol.html http://www.beyondlogic.org/ http://www.lvr.com/ |
From: <mik...@em...> - 2002-01-22 23:02:03
|
This is simple. You can add one of two things at the end of the source file, right before the return 0; --------First choice------- printf( "Press [enter] to quit..." ); getchar(); --------Second Choice------- system( "pause" ); ------------------------------ I prefer the first choice as I use Linux also, and in Linux no pause command exists. For DOS only apps though, the second choice works fine. __________ Mike Shoup [http://www.psxfanatics.com] ___________________________________________ At 20:06 20/01/02 -0500, Rob Orlando wrote: >I am just learning c++ and have a question. When I execute a file my >application only appears for a fraction of a second then disappears. How >do I get it to stay up so I can read it? >Jen |
From: Ioannis V. <no...@ya...> - 2002-02-11 01:07:24
|
Something useful: Recently, a report by IDC indicated that there are over 2.6 million professional developers worldwide using C/C++ as their primary language and over a million professional developers worldwide using Java as their primary language. This means over 37% of all developers worldwide are using these languages and the numbers continue to grow. Ioannis * Ioannis Vranos * Programming pages: <http://www.noicys.d2g.com/> http://www.noicys.d2g.com * Alternative URL: <http://run.to/noicys> http://run.to/noicys |
From: Nicole M. <nic...@ya...> - 2002-03-05 00:02:00
|
Pre-high schooler needs information on how to start learning programming Thanks --------------------------------- Do You Yahoo!? Yahoo! Sports - Sign up for Fantasy Baseball |
From: Jason H. <jas...@bt...> - 2002-03-05 01:20:38
|
Hi, When learning to program I wouldn't recommend C or C++ as your first = stop, as these languages are designed with flexibility and breadth of = scope in mind, and it's easy to get yourself in trouble. I think it's a = general consensus, when learning languages, to start with ones that = enforce a structure upon your programming in the hope that when you move = to a more relaxed language you carry the good design ideals over. Another thing that will affect your choice is whether you want to learn = structured programming or object oriented programming (and possibly any = other approaches?), and the design philosophies behind them. I have = found that learning one style doesn't necessarily make it easier to = learn the other, as they both approach the design and structure of a = program from a different standpoint, i.e. function centric versus data = centric (excuse me if I'm using the wrong language to express myself). I think most people start with a structured language, such as Pascal, = and move on to something like C, and then optionally learn object = oriented programming (OOP), with Java or (maybe Smalltalk or another?) = and move onto C++. I couldn't say what approach is best as it's = different for everyone. Once you have made your choice pick up any introductory text on that = language from your local library and try to pick up the ideas expressed = within it. I find that when approaching a new language that it's best to = start with the very basic books that can go into great detail about the = little stuff, and then work my way up the scale of books, i.e. basic, = intermediary, experienced, and expert (if you're brave), trying to pick = up some new insight from each. There are web-sites that contain reviews = of how good various books are, although you can't go too far wrong with = most beginner books. If you find in reading a book that it is boring you = with details that you understand already then either start skimming or = pick up a slightly more advanced book, however if you find that after = rereading a paragraph a couple of times you still don't understand what = is being said then you should try and find a different book that is = either more basic or uses different wording that may suit you better. Once you have gained a good understanding of a design pattern then you = may find that you can skip the easy stuff when learning a new language, = as the concepts usually cross over from one language to another. It then = becomes the task of picking up a different syntax more than anything = else, and then learning what the language makes possible for you from a = starting point. Most (if not all) languages have standard components (a = platform) on which all programs you write can be based. You could say that the essence of programming at it's most basic is to = be able to look at a task and break it down into a kind of recipe, an = algorithm, where you specify in detail a sequence of actions that = describe that task. You need to be able to both, identify the individual = actions in the task, and the order in which they should occur. Try = thinking this way about mundane everyday things to learn the frame of = though. There is more to programming than that, but I find that in the = end quite often that is what I am doing, although it's usually with more = abstract tasks like converting one piece of data into another. I would give an example, but I'm lazy. You could argue that laziness can = be a good thing in a programmer, but it would take too much time, so I = won't. ;-D You will probably find that most books will teach you programming for = console (text-only) based applications. You will find that learning to = use a programming language within a specific environment, such as = Windows, is a different journey altogether, but start at the beginning = and work your way up and you'll get there in the end. I hope my little discourse is useful, and that I haven't offended too = many people with sweeping inaccurate statements. Looking back, what I have said is probably just the tip of the iceberg. = I keep on wanting to add another idea or insight to a paragraph, but = I'll end up writing a book on learning to learn programming if I do = that! Jason. PS: If there's anything I was unclear on that you wish to know more = about then just e-mail the group and I'm sure that I or someone else = will fill you in. ----- Original Message -----=20 From: Nicole Mark=20 To: dev...@li...=20 Sent: Tuesday, March 05, 2002 12:01 AM Subject: [Dev-C++] (no subject) Pre-high schooler needs information on how to start learning = programming Thanks -------------------------------------------------------------------------= ----- Do You Yahoo!? Yahoo! Sports - Sign up for Fantasy Baseball |
From: David M. <ci...@ya...> - 2002-03-05 14:19:45
|
I learnt on pascal in high school and I just started college I would suggest pascal as it is a structured and if you are using turbo pascal it allows you to create objects so you can get to the advanced topics in C & C++ in this simple language as well as the constructs (the syntax of the program is uncannily similar. Pascal is not case sensitive and is a little kinder in terms of it's error messages. This should illustrate my point {hello world in pascal} Program Hello; uses crt; begin Clrscr; Writeln("Hello World"); readln; end. //Hello world in C #include <iostream.h> int main() { cout << "Hello World" << endl; system("PAUSE"); return 0; } As you can see the structure is quite similar and thus when you decide to move up to C or C++ the jump is quite small (all you have to do is learn different syntax and functions). I regret to say that there are not many good books on store shelves but you can find quite a few good tutorials on the internet(or just write me for help). (P.S. sorry this was so long I just had to put in my two cents) At 07:01 PM 3/4/2002, you wrote: >Pre-high schooler needs information on how to start learning programming > >Thanks > > > >Do You Yahoo!? >Yahoo! Sports - Sign up for ><http://baseball.fantasysports.yahoo.com/>Fantasy Baseball _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com |
From: Ioannis V. <no...@ya...> - 2002-03-22 17:45:54
|
Dear friends, my email address has changed to no...@ho... . Regards, Ioannis * Ioannis Vranos * Programming pages: <http://www.noicys.d2g.com/> http://www.noicys.d2g.com * Alternative URL: <http://run.to/noicys> http://run.to/noicys |
From: EFE B. <dou...@ya...> - 2002-03-29 06:09:42
|
dou...@ya... __________________________________________________ Do You Yahoo!? Yahoo! Greetings - send holiday greetings for Easter, Passover http://greetings.yahoo.com/ |
From: Christian W. <Chr...@vo...> - 2002-04-02 09:06:42
|
Hi List, can someone explain me how to write a DLL ??? (I have tryed some HowTo's but i want to undertand the difference between WORD / LPCSTR... anbd how to call them (and get a return ...) Thanx Chris |