![]() |
|
#1
|
|||
|
|||
compiling errorHi,
My name is jenny A friend gave me this file to compile. My goal is to open 4 browser windows and then close them via "end task" with a delay between them. When I try to compile it (dev-C++) I'm getting this error message, How can I solve it? ------- 68: Invalid conversion from 'const char*' to 'CHAR*' ------- Source file: --------------------------- CPP / C++ / C Code:
I'd also like to run it for a period of time... I wonder if someone can complete and test my program. Thanks, Jenny (I don't understand anything about programming) Last edited by dsmith : 03-Sep-2004 at 08:07.
Reason: Please use [c] & [/c] for syntax highlighting
|
|||
|
#2
|
||||
|
||||
|
Ok, then. Well, since I don't know anything whatsoever about the program, I'll just assume, and this is probably a bad assumption, that the problem is a mismatched type in the CreateProcess function call. So, go ahead and find the line that says:
CPP / C++ / C Code:
...and just get rid of the word const, and try to compile it again. Come back for help if it gives you more errors. Question: Why are you trying to compile a program if you don't know anything about programming? Why couldn't your friend compile it for you? You appear to be running on Windows, so I don't see why your friend couldn't just compile it and send you the binary... __________________
-Aaron |
|
#3
|
||||
|
||||
|
In addition to that, the lines that Aaron identified have some other errors in them that should prevent this thing from compiling anyway:
CPP / C++ / C Code:
Should be: CPP / C++ / C Code:
Note the exclusion of the semicolon at the end of each line as well as the '\\' instead of '\'. I am not much of windows programmer unfortunately, but I have to agree with Aaron somewhat. It seems that whoever wrote this had a definite plan and could code. (I am actually pretty shocked about the errors int the string literals). Do you not know this person anymore? I will try to find some documentation for the createProcess function. This is probably the "proper" way to do something like this, but depending on how robust you want the program to be, a simple call to system sure seems easier... ![]() Anyway, sorry for the not so immediate and not so conclusive help. If no one else has any great ideas, I will look into it a bit more... __________________
The best damn Sports Blog period. |
|
#4
|
||||
|
||||
|
... and I am sorry for yet another bug in the syntax highlighter. I need to set a thread pointing to all the threads inside this forum, that display C++ syntax highlighting bugs.
__________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
|
#5
|
||||
|
||||
|
Quote:
hehe. I was going to point that out to you, but I know that you are pretty busy. Still this is the *best* syntax highlighter on a forum that I have ever seen. (But I don't get out much...) __________________
The best damn Sports Blog period. |
|
#6
|
|||
|
|||
|
Quote:
I have had to literally sit on my hands and metaphorically bite my tongue to keep from responding, but I can't stand it any more. Jenny, your friend has given you a program with bugs that make it not compile on any Windows compiler (or any other standard C++ compiler). You don't know much about programming, but you are attempting to compile a program that, when the bugs are fixed, continuously invokes Internet Explorer that attempts to visit four web sites. Do you know what the web sites are? How do you know they are benign? Are you aware that there are Internet Explorer bugs that can be exploited by visiting malevolent web sites? (I don't think site1.com, site2.com and site4.com actually are malevolent. I wasn't able to get site3.com to come up.) The program loops forever. If you don't know enough about dev-c++ to find the bugs in the program, would you know how to stop the infinite loop of continously visiting the sites? I don't mean to be unkind, but I have to ask: why would you want someone here to tell you how to fix your friend's program in the first place? Why would you not ask your friend? To people that are responding to this: am I the only one with misgivings about helping on this? How would you respond if someone said, "My friend loaned me a gun, but gave me the wrong bullets. I don't know much about guns, so can you help me find out how to obtain the correct ammo so that I can load it?" Sorry if this is out of place on this forum. Moderators: feel free to delete this if you see fit. Please consider that I have only good intentions in posting this, and I am sorry if it comes out too harsh. Dave |
|
#7
|
||||
|
||||
|
You're fine Dave. I think we are all scratching our heads a bit with this one. I don't think that site1, site2, site3, site4 were literal, just examples. Maybe I don't see the same level of malignancy that you do, but I do have to wonder about why this is not being asked of the original writer of this code.
Jenny - if you are still around - I don't want you to get the wrong idea. We are more than willing to help, it is just a strange request and Dave is correct in pointing out that if you don't know *anything* about programming, you may not want to be compiling any code that you get, yet alone C code. __________________
The best damn Sports Blog period. |
|
#8
|
|||
|
|||
|
Quote:
But the program, when the bugs are fixed, will actually invoke internet explorer and go to these URLs. My point is: why would someone try to compile and execute a program if they don't understand what the program will do? Regards, Dave |
|
#9
|
|||
|
|||
|
As a follow-up to my negative comments, I would like to offer some positive points.
If I had a friend who was studying Windows programming and wanted to see an example of using CreateProcess() and TerminateProcess() to create and delete Internet Explorer processes, I might do the following: 1. Use indentation to show how to make a program more readable. 2. I would point out that this program has main(), so is a Console application, even though it uses Windows API calls. 3. I would put instructions before the beginning of the for( ; ; ) loop. Something the user can read when the program executes, like CPP / C++ / C Code:
Note that you have to #include <stdio.h> to use printf(); 4. I would put some kind of error message in case the CreateProcess() failed. Something like CPP / C++ / C Code:
5. I would use commands that wouldn't actually go onto the Internet and try to access web sites; If I knew the friend's Windows installation was on drive C: the commands could be something like. CPP / C++ / C Code:
If the friend asked what the heck this is doing, I would explain it a little. 6. I would make sure that the program would compile and execute with whatever compiler the friend is using. Here is the message that Jenny asked about: Quote:
Note that this is an error in C++, but a warning in C. The program with the changes that I have indicated is a valid C program, and is also a valid C++ program (by leaving the const off of the cmdLines[] definition). Best regards, Dave |
Recent GIDBlog
Accepted for Ph.D. program by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Operator Overloading: << | aaroncohn | C++ Forum | 36 | 07-Dec-2004 20:22 |
| error when compiling | avi | C Programming Language | 2 | 11-Aug-2004 04:17 |
| link error? | pablowablo | C++ Forum | 14 | 19-Jun-2004 11:00 |
| OpenGL always reports error | mvt | OpenGL Programming | 2 | 04-Jun-2004 07:42 |
| Visual C++ 6 Compiler error | vip3r | C++ Forum | 2 | 13-Apr-2004 15:34 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The