Welcome Guest ( Log In | Click here to Register a free account now! )
Welcome to Bleeping Computer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.![]() ![]() |
May 12 2009, 02:53 PM
Post
#16
|
|
![]() Look buddy -- I'm an Engineer ![]() ![]() ![]() ![]() ![]() ![]() Group: HJT Team Coach Posts: 8,509 Joined: 17-January 08 From: Northfield, Ohio Member No.: 184,215 |
Keep in mind that path is a pointer... not an array object. Where is the memory that contains the string L"C:\\WINDOWS\\system32\\test.exe"? Billy3 -------------------- The forum is always a busy place. In the event I fail to reply within twenty-four hours, feel free to send me a PM.
Have I helped you? If so, please consider a donation (by clicking this link). And that means I solve problems. Not problems like "What is beauty?" .. 'cause that would fall under the purview of your conundrums of philosophy.... |
|
|
|
May 13 2009, 03:50 AM
Post
#17
|
|
|
Member ![]() ![]() Group: Members Posts: 16 Joined: 11-May 09 Member No.: 330,588 |
Ah yes
KaZu |
|
|
|
May 13 2009, 09:47 PM
Post
#18
|
|
![]() Look buddy -- I'm an Engineer ![]() ![]() ![]() ![]() ![]() ![]() Group: HJT Team Coach Posts: 8,509 Joined: 17-January 08 From: Northfield, Ohio Member No.: 184,215 |
Err... What?
Billy3 -------------------- The forum is always a busy place. In the event I fail to reply within twenty-four hours, feel free to send me a PM.
Have I helped you? If so, please consider a donation (by clicking this link). And that means I solve problems. Not problems like "What is beauty?" .. 'cause that would fall under the purview of your conundrums of philosophy.... |
|
|
|
May 14 2009, 09:28 AM
Post
#19
|
|
|
Member ![]() ![]() Group: Members Posts: 16 Joined: 11-May 09 Member No.: 330,588 |
Aha didnt see your question, just the first thing about the pointer..
As I have been learned. Path is a pointer and its in the new wchar_t[80] memory the String is allocated. Do I got it right? KaZu |
|
|
|
May 14 2009, 03:11 PM
Post
#20
|
|
![]() Look buddy -- I'm an Engineer ![]() ![]() ![]() ![]() ![]() ![]() Group: HJT Team Coach Posts: 8,509 Joined: 17-January 08 From: Northfield, Ohio Member No.: 184,215 |
Heehe... but you never allocated that string, did you?
Billy3 -------------------- The forum is always a busy place. In the event I fail to reply within twenty-four hours, feel free to send me a PM.
Have I helped you? If so, please consider a donation (by clicking this link). And that means I solve problems. Not problems like "What is beauty?" .. 'cause that would fall under the purview of your conundrums of philosophy.... |
|
|
|
May 14 2009, 03:27 PM
Post
#21
|
|
|
Member ![]() ![]() Group: Members Posts: 16 Joined: 11-May 09 Member No.: 330,588 |
hehe no
KaZu |
|
|
|
May 14 2009, 03:29 PM
Post
#22
|
|
![]() Look buddy -- I'm an Engineer ![]() ![]() ![]() ![]() ![]() ![]() Group: HJT Team Coach Posts: 8,509 Joined: 17-January 08 From: Northfield, Ohio Member No.: 184,215 |
What operation does the = actually perform here?
Reason I'm asking here is because this is one aspect where C is different from pretty much every other language..... Billy3 -------------------- The forum is always a busy place. In the event I fail to reply within twenty-four hours, feel free to send me a PM.
Have I helped you? If so, please consider a donation (by clicking this link). And that means I solve problems. Not problems like "What is beauty?" .. 'cause that would fall under the purview of your conundrums of philosophy.... |
|
|
|
May 15 2009, 02:15 AM
Post
#23
|
|
|
Member ![]() ![]() Group: Members Posts: 16 Joined: 11-May 09 Member No.: 330,588 |
Hm I guess that = says that Path points on a new memoryspace?
KaZu |
|
|
|
May 17 2009, 08:28 AM
Post
#24
|
|
|
Member ![]() ![]() Group: Members Posts: 16 Joined: 11-May 09 Member No.: 330,588 |
One more question. Would this code work on vista?
KaZu |
|
|
|
May 17 2009, 05:23 PM
Post
#25
|
|
![]() Look buddy -- I'm an Engineer ![]() ![]() ![]() ![]() ![]() ![]() Group: HJT Team Coach Posts: 8,509 Joined: 17-January 08 From: Northfield, Ohio Member No.: 184,215 |
Hello
QUOTE Hm I guess that = says that Path points on a new memoryspace? Nope. When windows starts your EXE file, it copies the executable into memory space. The = operation simply assigns the address of the executable's memory mapped string to the pointer. Unlike languages such as C# or Java, strings in C are not objects. The = operator does not work with them. Neither do + or anything like somestring.substring as they do in other languages. C strings are raw memory arrays. All you can do with them is exactly how you might act on an array. If you want to do simple operations such as copy, concat, or anything like that, you need to use library functions. Copy: strcpy(copyTo, copyFrom); Concat: strcat(addTo, addFrom); etc. A list of such library functions can be found here: http://www.cplusplus.com/reference/clibrary/cstring/ They are all in "string.h" (for C) or <cstring> (for C++). The final thing with C strings is that you need to ensure enough RAM is allocated at the target location. These calls will NOT fail or cause any error in the event you overwrite past the end of the array. C has no bounds checking on arrays, and if you overwrite one you can crash the operating system, or possibly overwrite part of your progam's code (A "buffer overrun"). Be careful working with C strings. For a safer alternative, if you have access to C++, you can use C++'s std::basic_string<> type. QUOTE One more question. Would this code work on vista? Not sure. However see this link on MSDN: http://msdn.microsoft.com/en-us/library/ms724842(VS.85).aspx QUOTE Note This function is provided only for compatibility with 16-bit versions of Windows. Applications should use the RegCreateKeyEx function. Hope that helps, Billy3 -------------------- The forum is always a busy place. In the event I fail to reply within twenty-four hours, feel free to send me a PM.
Have I helped you? If so, please consider a donation (by clicking this link). And that means I solve problems. Not problems like "What is beauty?" .. 'cause that would fall under the purview of your conundrums of philosophy.... |
|
|
|
May 18 2009, 03:31 AM
Post
#26
|
|
|
Member ![]() ![]() Group: Members Posts: 16 Joined: 11-May 09 Member No.: 330,588 |
Ah thanks for the information. I used c++ for this code so should not be that hard :-)
KaZu |
|
|
|
May 18 2009, 05:42 AM
Post
#27
|
|
|
Member ![]() ![]() Group: Members Posts: 16 Joined: 11-May 09 Member No.: 330,588 |
Billy can I ask you another question instead of creating a new topic?
The question is about creating a setup wizard in c++. I have used it now to my project and made the 5 steps, but how do I compile it and make it to create a install file? KaZu Nvm I solved the problem This post has been edited by KaZu: May 18 2009, 08:00 AM |
|
|
|
May 20 2009, 09:48 AM
Post
#28
|
|
|
Member ![]() ![]() Group: Members Posts: 16 Joined: 11-May 09 Member No.: 330,588 |
Yes it´s :-) Would be great for others to have a article about this. It will mostly solve all the problem
KaZu This post has been edited by KaZu: May 20 2009, 10:01 AM |
|
|
|
![]() ![]() |
| Lo-Fi Version | Time is now: 8th November 2009 - 05:43 AM |