Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

As to the debate issue, teachers are human beings too, all with our own little bug-bears

:icon_eek: Now you have just destroyed my faith in our educational system.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>queue<string>* Pages_Queue
One possibility is the way you are using this pointer. The Parser class does not own the memory for this pointer, its just passed into one of the methods. Consequently the pointer could get deleted or reused somewhere else and Parser class would be none the wiser. IMO that is a dangerous situation. It would be safer for LoadPages() to copy (duplicate) that queue rather than just using the same pointer so that it has its own copy.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Example: Found most of this here

using namespace System;
using namespace System::Collections;

int main()
{
   String^ words = "111,222,333";
   Char chars[] = {' ', ', ', '->', ':'};
   array<String^>^ split = words->Split(',');
   for(int i = 0; i < split->Length; i++)
       Console::Write(  "\t{0}\n", split[ i ] );
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

This works ok for me

int main(void){
	FILE * input;
	char * nlptr;
	long position;
	long count;
	char ch;
	char name[81];

	fprintf(stdout, "please enter a text file\n");
	fgets(name, 81, stdin);
	nlptr = strchr(name, '\n');
	if(nlptr)
		*nlptr ='\0';
	input = fopen(name, "r");
	printf("enter a file position\n");
	fscanf(stdin, "%d", &position);
	while(getchar() != '\n')
		continue;
	fseek(input, position, SEEK_SET);
	for(count = position; (ch = getc(input)) != '\n'; count++){
		putc(ch, stdout);
	}
	
	fclose(input);
	printf("\n");
	return 0;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>How can I, convert str, from string to char(array of char).
cause, if in array, I can easy split the content of that file.

What is it that you want to do with that String? Have you looked at the methods it provides to see if it already does what you want to do?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

you might search these links

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

this thread is so *** up

I suppose you got lost somewhere. If its beyond your comprehension then I'd suggest you don't read it. You need more than 1st grade reading skills for this thread :)

colmcy1 commented: Great help yet again, thank you +1
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Now this is a marriage to be proud of :) Married 83 years, they have 186 descendants. :icon_eek:

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>"\EvolveTraffic.exe"
Remove the \ character. Looks like a typo, but check the code you actually wrote.

>>sorry I'm abit lost, lots of new functions
Only one or two. Read all about them on MSDN. Also write your own little programs to test and try them out so you can understand them better.

>>Surely the FindWindow() function will only work if the .exe file is open??

Well yes, and the executable must be a windows program. It won't work with console programs because EnumWindows() only shows "C:\Windows\system32\cmd.exe", which isn't much help.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Here is just one of may articles you can find about that topic.


Here are some others.

Salem commented: Works for me :) +36
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>if (!"\EvolveTraffic.exe")
What is the world is that supposed to do ????

>>HWND hWnd = ::FindWindow(NULL,"EvolveTraffic.exe");

FindWindow() looks at the window's title, not the name of the executable. As a test, write a short program that calls EnumWindows() and see all the values that it returns. Run the program below and pick the title of the window you want to pass to FindWindow()

BOOL CALLBACK EnumWindowsProc(HWND hwnd,LPARAM lParam)
{
   char text[255];
   GetWindowText(hwnd, text, sizeof(text));
   if( text[0] != 0 && !strstr(text,"Default") )
    std::cout << text << "\n";
   return TRUE;
}
int main()
{
     EnumWindows(EnumWindowsProc, 0);
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>can you explain why it wont work?

It won't work because the addresses will change every time the program is run. Windows hook functions work because you pass it a pointer to the function, not the actually address value.

This should work

void PHook(void)
{
	cout << "Bye";
}
void (*fn)(void) = PHook;

void Hook()
{ 
	fn();	       
          
}

or this

void PHook(void)
{
	cout << "Bye";
}

void Hook(void (*fn)() )
{ 
	fn();	       
          
}

int main()
{
    Hook( PHook );
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

thread closed.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

[*]And yes, try to squeeze your code in 80 character width as people like me ( who run your code in 80-sized terminals) often find it harassing when our text editor wraps the long lines . Use \ character for doing this.

Sounds like a problem for the chaplain to me. :) My advice to you: come into the 21st century and get a newer terminal. I have not seen an 80-character width terminal in some 25+ years.

Also note that the \ characters at the end of lines 20-22 of the code you posted are unnecessary.

iamthwee commented: *nods* +22
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

There must be something else wrong or you posted the wrong code because the code snippet you posted is correct.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Do you go to an auto repairman and say "my car is broke -- please fix it. And BTW I left my car at home." No of course you don't. You have to take your car there and tell him what you think is the problem. Same here. We can't help you id you don't tell us what you need help doing and post the code that you tried. Afterall, we can't read your mind and certainly can't see your monitor.

And if you think we will write the program for you -- forget it because we won't.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I'll miss the sound of the chainsaw slashing through newbies code.

Yes, I thought that avatar was very appropriate for her personality too :)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Well, microsoft did take it to extremes. The EU asked for modularity and choice, allowing users and OEMs to replace things like IE easialy, not nececerially the total removal of the bundled apps such as IE.

Be careful what you wish for -- you might (and did) just get it :)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Note that even if s1 were not a string literal the program would not work because s1 was not allocated enough memory to contain both s1 and s2 at the same time.

char s1[80] = "Hello ";
char* s2 = "world";
strcat(s1,s2); // ok now
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

'\n' in C program is standard across platforms, and the underlying implementation code (standard C libraries) translates it to whatever the operating system uses. It can be "\r\n" on MS-Windows, "\n" on *nix, "\r" in MAC, or anything else on other operating systems. For files opened in text mode all you need to do is specify '\n'. When files are opened in binary mode no conversions are made, so you have to know what os you are working with in order to translate them yourself.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

installations program normally copy not only the executable but also install DLLs and set registry entries. If your program does not need to install DLLs or set registry entries then merely copying the executable to the hard drive might be sufficient.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

jephthah, your english is significantly powerful and better than most of the native speakers, i associate it with the fact that you must have been reading some good books.

Yea, he knows how to curse :) .. and get away with it :)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Happygeek and Dani have the same powers as a global mod already.

Actually they have powers way beyond that of a SMod.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

But I'm not unhappy with Vista. I just like installing new operating systems. I've tried various *nix distributions, but they are just too complicated.

Actually there is one reason I'm going to upgrade -- the Pro edition has an XP compatible mode in which I am hoping can play that game again :) As for less features -- I have not heard anything about that, other than it will be stripped down in Europe. But since I don't live there I don't really care about that. The Europeans did that to themselves, Microsoft had nothing to do with it.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

damn, i put a lot of creative effort into that poll. :(

Look on the bright side -- you didn't get banned did you?

jephthah commented: okay, I lol' +14
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

In that case, sockets or COM would probably be best.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

windows is not a compiler -- its an operating system. IMHO vc++ 2008 Express is one of the best compilers/IDEs available today. It produces a lot of errors and warnings that other compilers completly miss. And its debugging facilities can't be beat by any other IDE/compiler on any operating system.

Instead of changing compilers at this point, find out how to increase the warning level so that it will produce better errors and warnings.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I didn't know that forum even existed :P

you need to explore our wold of DaniWeb a little more. You might be surprised what you will find.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Oh you people complain about a few minutes boot time! You should work with mainframe computers which can take several hours to boot. Of course I realize you don't have mainframe computers on your laptops :)

I've been using Vista Home Premium for a couple years now and have grown to actually like it. I never have any problems with it, except that it won't play my favorite game that I played in XP.

As for MS-Paint -- I don't really care what changes they make to it as long as it still has the ability to open files in one format and save them in another. That's the only thing I use it for.

And yes, I'm upgrading to Windows 7 in October. Why? Just because, that's why.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

But ancient dragon, please admit it , you laughed when you read that poll, didnt you ?

No, I did not. I didn't find it the slightest bit amusing. In fact it was the thread's title that first set me off.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I deleted that poll and thread because we don't flame/attack other members. I don't care if serkan did approve of it -- flaming by any other name is still flaming.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Hello.

why did you post a link to amazon.com books ???

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Good thinking! I forgot I could just search in Comm Intros for my threads. And you are right -- I did not do it. Oh well, its a tad late now.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I'd bet my paycheck that most of the big names haven't.

I tried to search all the threads I started but there are apparently too many because it won't return any threads earlier than 2009.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Probably because you are passing uninitialized variables to functions. If your compiler didn't produce these warnings then use a different compiler.

1>c:\dvlp\test9\test9\main.cpp(59) : warning C4700: uninitialized local variable 'lpcd' used
1>c:\dvlp\test9\test9\app.cpp(16) : warning C4700: uninitialized local variable 'lister' used

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Do I really need to ? I've been a member here since the stone ages.:)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

In windows program, WinMain() replaces main(), and you can't use cout or cin because windows programs are not console programs. cout and cin will compile, but will do nothing. fstream to read/write to/form the file system will work at expected.

You have to use the win32 api gui functions to write text in the window, as illustrated in this tutorial

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

In function GetCDLists() (main.cpp) you have an object also named GetCDLists. Rename that object to something else, such as GList, or whatever. Just don't give it the same name as the function name.

Then a little later in that function you attempt to call the function with a parameter. That function does not take any parameters.


CDRip::GetVersion: you have to put a return value at the end of that function.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>all the tutorials I've found on windows programming describe how to do this whole thing in C not C++

That's because all win32 api functions are C functions, not C++. But they can be called from c++ as well as most other programming languages.

>>I'm not against converting my existing piece to c equivalent to make it compatible with the C code for windows programming
That's not necessary. Just use the C win32 api code in your c++ programs, it will work fine with no problems whatsoever.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

did you ever hear of the increment ++ operator a = a + 1; then call sprintf() again to reformat the string.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

There are several ways to fix it.

#include <iostream>
using namespace std;

or

#include <iostream>
using std::cout;
using std::cin;

or

std::cout << "Enter Customer's Name: ";
std::cin.getline(name,15);
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

symbolic links are only support in NTFS file systems on W2K systems and newer. Read this article (maybe you have already seen it, I don't know).

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>void main();

Remove the semicolon

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

This all works perfectly fine in an administrative environment - but soon the application will be migrated to a restricted (user) account where the running application (A) does not have the rights to launch application (B) to the necessary work. The solution, have an administrative service (service installed when logged on as admin during software installation), and have this service communicate between (A.exe) and (B.exe)... Let's call the service (C) ...

The solution is for the programs to call win32 api function LogonUser() so that they can inpersonate an Administrative account. I have done that may times and it works well. I stored the account name and encrypted password in the registry, then change that password frequently (such as weekly). The registry entry is initially created during program installation, which is run under an administrative account.

>>Since you're on windows you could use pipes,
Pipes don't work on MS-Windows programs.

If used in a Windows program, the _popen function returns an invalid file pointer that causes the program to stop responding indefinitely. _popen works properly in a console application. To create a Windows application that redirects input and output, see Creating a Child Process with Redirected Input and Output in the Windows SDK.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>its giving me syntax error.
Where?? What line number


>>Also, the logic is correct according to me..
That's the root of all bugs :)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Today my wife and I have been married (to each other :)) for 47 years. Going to wine and dine this evening so you won't see me around for the rest of today.

kvprajapati commented: The Great man. +7
jephthah commented: belated congrats! +14
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

What exactly is the problem with it. Do you also take your car to the garage and tell them "my car is broke -- please fix it". Of course you don't -- you have to tell them what you think is the problem or the symptoms.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Ill have to start putting you as a co-author in my papers :) thanks again

Please DON'T