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

LogonUser() will allow you to log onto the computer if you know a valid user name and password. There are no functions to retrieve the password of a given user -- it would be a huge security violation if there was such a function.

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

must be because you are a mod:mrgreen: I don't see that problem.

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

[deleted]

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

>>printf("table 1 is %d\n", table_1);

That only prints the memory address of the beginning of table_1, which is an array of binary data. I have no idea what is stored in that array, you might get an idea from the program that contains the array.

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

attempt to open it with fopen() or ifstream::open(), depending on C or C++ program.

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

What's your favourite tv show at your retirement home? :cheesy:

Lawrence Welk, from the 1950s:eek: Also Dr. Who from BBC that started almost 30 years ago but was revived about a year or so ago.

>>Huh? It just clicks it?
Yup, clicks it, not moves it.

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

Most windows messages do NOT have a corresponding function. You are treading into areas which will force you to learn Windows programming whether you like it or not, or you could always just go watch a TV show :cheesy:

[edit]The code that Jamthwee just posted will move the mouse, it won't tell you when (or even if) the left button was clicked.[/edit]

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

post your code using std::string because it does work with that. replace strstr() with the std::string's find() method, like this

for(int i=0; i<20; i++)
 {
	 if( data[i].find(search) == string::npos )
		cout << "NO MATCH" << endl;
	else
	{
		cout << data[i] << endl;
		incVar++;
	}
 
 }
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Any chance anyone could give me a line or two that tells it to leftclick at its active location? I can't find this in C++. :-/

catch the WM_LBUTTONDOWN event in the WinProc event handler.

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

that seems to work ok :) next trick is how to know when the cursor moves? or when the left mouse button is pressed? How will you know when to call GetCursorPos() as stated in your original post? A console program does not get windows events so it will not know when the cursor is moved over the bitmap, or between bitmaps or anywhere else on the window.

[edit]There is a whole series of console functions that might help you. Look for consol win events where you can set up an event handler for mouse events. I haven't tried it so you might have to do some experimentation with it.

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

If you really did go through that tutorial -- thoroughly I might add -- you should know that what you posted is not even close to being correct. Read it thorougly again, or again, or as many times as it takes for you to know it well. If you are not willing to put in the effort to do that, then nobody else is going to do it for you.

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

Well here is a c++ version that should be portable and returns the same as itoa().

string my_itoa(int value, int base)
{
	string s;
	for(int i = base; value && i ; --i, value /= base)
	{
		s = "0123456789abcdefghijklmnopqrstuvwxyz"[value % base] + s;
	}
	return s;

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

probably something like below: count using normal integers but convert to base62 for display.

#include <cstring>
#include <iostream>
using namespace std;

int main( )
{
	long n = 1234576;
	char buf[255];
	 _itoa( n, buf, 62 );
	cout << buf << "\n";
    return 0;
}

Warning: The above code is not ansi standard. Here is a link you might be able to use if you need something ansi standard.

[edit]I have done a little testing with the algorithms in the link I posted and none of them produce the same result as _itoa() function. The first algorithm for my_atoi() might be a fairly simple fix -- it just leaves off the last digit.[/edit]

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

>>I can't imagine it taking up much more than 10-15 lines

HaHa you really are new to this aren't you! run through the tutorial I posted previously to get down the basic window then add a little code to check for WM_MOUSEMOVE events. You will probably know how to do that once you have completed the tutorial.

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

The window's message pump should be checking for WM_MOUSEMOVE messages. This message will give you the cordinates of the mouse. If you are not at all familiar with win32 api functions, then a good place to start is with this tutorial.

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

windows api will return the x,y coordinates of the mouse. If you know the coordinates of the image's bounding rectangle then you just need to find out which image rectangle contains the mouse coordinates. Using MFC will simplify that, but you can also use windows RECT structure and write your own code to make the "hit test".

If you are not using MS-Windows, I have no clue how to do it with *nix.

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

ODBC is the most common way to access SQL databases. Search google for ODBC and you will find some c++ classes. Example here and here

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

Here seems to be a source where you can get that compiler. I don't know if that link is still any good.

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

there are two ways to declare a one-dimentional array

(1)??? calculateEarned(worker array[]);

and
(2)??? calculateEarned(worker * array);

but there is only one way to declare the return value, using a pointer to the beginning of the array.
worker* calculateEarned(worker []);

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
fscanf( fINPUT, "%s", &IP_name[j]);
		printf("%s\n", &IP_name[j]);

remove the & symbol, the compiler is passing a pointer to a pointer, which is not what you want it to do.

fscanf( fINPUT, "%s", IP_name[j]);
		printf("%s\n", IP_name[j]);
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

are the input strings longer than 19 characters? there might be something else going on in your program that is trashing the memory and pointers.

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

Hi I've done like this and it works:

char **IP_name;
	IP_name = new char* [InputNumber];
	for (int i=0; i<InputNumber; i++)
	{
		IP_name[i] = new char[20];
                fscanf( fINPUT, "%s", &IP_name[j]);
		printf("%s\n", &IP_name[j]);
	}

The only problem is to free the memory with delete... I tried with:

for (i=0; i<InputNumber; i++)
	{
		delete IP_name[i];
	}
	delete IP_name;

Unsucessful... :(

you forgot to use delete[] instead of delete. Remember: new[] requires delete[] -- they go in pairs.

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

>>fscanf( fINPUT, "%s", &IP_name[j]);

IP_name is a simple charater array, not an array of strings. If you want to store two or more strings in IP_name (for example "Joe" and "Harray") then you need to make IP_name an array of InputNumber number of strings. Something like this. But if you are writing a c++ program you should use c++ vector and string classes to avoid the messy memory allocation stuff and associated error-prone problems.

int InputNumber = 5;
char ** IP_name;
char buffer[255]; // for file i/o
IP_name = new char*[InputNumber];
for (int j=0; j<InputNumber; j++)
{
		
   // Read data back from input file: 
   fscanf( fINPUT, "%s", buffer);
   IP_name[j] = new char[strlen(buffer)+1];
   strcpy(IP_name[j],buffer);
}

// don't forget to deallocate all that memory when done with it.
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

allocate the array with either malloc() or new, depending on whether you are writing a c or c++ program.

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

you can google for cgi programs. Here is one suggestion.

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

use != not the == operator. But yes, C style strings always should be terminated with '\0' null terminator.

while(charbuff[i] !='\0')
{.........

or it is a better way?

depends on what you want to do.

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

why don't you make i a local variable and function() return its value.

#includes....
 
 
int function()
{
 int i = 0; 
while(charbuff[i]!=' ')
       {
            ofstream stream("file.lng", ios::app)
            stream << charbuff[i];
            i++;
            stream.close();
        }
return i;
}
 
main()
{
      ........... some code
  int i = function();                                  /*call function */
      cout << i;                                  /* the i is set to 0*/
      ........... some code
 
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

reinstall the compiler.

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

You can find two tutorials here and here

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

what compiler are you using? my guess is Turbo C, but I could easily be wrong.

As for unused variables -- just delete them from the program.

>> strcpy(fn[p],fn);

fn is a character array, fn[p] is a single character somewhere in that array. strcpy() expects the first parameter to be a pointer to the destination string. Instead your program is just passing a single character.

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

[rant]flow charts are evil little critters and should be banned from all educational institutions. I've never seen anyone create or use them outside the university. And most programming books don't even talk about them.[/rant]

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

where is the question?

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

sagar: you are attempting to explain away something that has unspecified behavior -- the standards say it is unspecified, not me. For more information see this thead.

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

why do you think that registry key is going to launch mydll.dll every time a program is run? I tried it on my XP computer and it does nothing too.

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

there is nothing wrong with your compiler. It does not work as you expect because the code you posted as undefined behavior.

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

Most common way to connect to any database is via ODBC. Here are some tutorials.

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

The maximum would be 5 + 10, just toss out all negative values.

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

how is update_record defined? It would appear to be a structure, not a simple string as you illustrated. We need more information to help you.

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

what operating system? MS-Windows? use FindFirstFile() and FindNextFile() to get a list of all the files in dir A, store the filenames in a string array. Then use the same functions to get the files in directory B. For each file in B search the array of filenames you created from directory A, if found the delete the file.

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

If the file is pretty much static (doesn't change very often) then you can create an index file that contains just the offsets into the master data file of the beginning of each record. Then when you want to read the 50th string just read the offset in the 50th record of the index file then seek to that position in the master data file. Each record in the index file is a 64-bit integer, so it is eash to seek to the desired record in the index file when you already know the record number.

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

This c++ example from boost looks promising. Never used it myself.

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

I think Boost Libraries has some xml parsing functions that might help

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

Um. I think you got it confused dragon. He is infact looking to read an XML file. So I think your first link is correct.

Well, in that case forget what I posted about Excell Automation -- it has nothing to do with XML files. Guess I must be getting senile in my old age:mrgreen:

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

The link should have been this one. But then you could have easily found that out yourself.

And here are some others about Excel Automation

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

>>please tell me by some giving some points...as to what the approach should be....instead of giving google links

The link I posted was incorrect -- see my next post for some good ones.

you really need to learn to do some research on your own. reading xls files isn't a simple task. The file format is a Microsoft secret, subject to change from one version of Excell to another, and requires knowedge of COM because you will be calling some Excell functions to manipulate the file, you don't do it in your program directly because you will not know the file format. If you really want to do that there is information out there that you will need to study. google is the FIRST place you should be looking and maybe a book from www.amazon.com or your local book store.

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

try any one of these, but be prepared to learn lots of COM stuff. This is one case I recommend doing it in VB.

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

See -- here's a good example of where to have a Delete My Post button[code deleted -- duplicate of Dave's original code] See -- here's a good example of where to have a Delete My Post button

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

>>Is it like below wat u said:

did you test it to verify whether it works or not ?

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

just use strcpy() and strcat() to create the new filename. you will have to truncate the file extension first. Now you will have to pass new_filename as another parameter to CS_write() function so that it can use it in the fopen() function instead of the hard-coded text.

char new_filename[512];
strcpy(new_filename,argv[1]);
// locate the file extension, if there is one
char *ext = strrchr(new_filename,'.');
// now truncate it
if(ext != NULL)
   *ext = 0;
// add _new
strcat(new_filename,"_new");
// add the file extension
ext = strrchr(argv[1],'.');
if(ext != NULL)
   strcat(new_filename,ext);
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

1. it is not necessary to specify ios::in for ifstream, that is what ifstream does anyway.

2. use std::string's c_str() method when passing it to the constructor

ifstream openfl(file.c_str())

3. cin >> file; This construct will work as long as there are no spaces in the filename and optional path. use getline() if it can contain spaces

getline(cin,file)