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

There are 299,968,595 people in the United States of America. If everyone in the U.S. lined up single file, the line would stretch around the Earth almost 7 times. That's a lot of people.

Now compare that with the population of China (1,284,303,702 -- 2002 est). Yet the area of China is only slightly LESS that that of the USA.

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

are file1 and file2 in separate DLLs? The term "plugin" is meaningless. Those files are either in a dll, library or part of the application program. Please be a bit more specific about how your program is designed.

If you want to put file1.cpp and file2.cpp in a DLL then you can do one of 3 things that I can think of:
1. use namespaces -- put each instance of callfunc() in a different namespace and export them in the DLL with dllexport, then in the application program using dllimport o import them. There was another recent thread here that has an example of how to do that.

2. put callfunc() as a method of a class.

3. Since file1.cpp and file2.cpp are c++ files, you can create callfunc() with different sets of parameters -- that will prevent duplicate definition errors.

[edit]sorry, I didn't see your second post[/edit]
>>keep in mind that this plugin isn't part of a .dll, it's compiled alongside the main .exe as source
then if callfunc() is NOT in a DLL than you can NOT use dllexport or dllimport.

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

>>void callfunc() { }
The function can be coded in one and only one file. All other files the function must be prototyped using the extern keyword.

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

you failed to prototype function myf() before it was used, so the compiler make an incorrect assumption that it returned an int. Add the function prototype double myf(double x); before function main but after the includes.

And thank you for using code tags to make your code easy to read.:)

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

dllexport and dllimport are only used in DLLs. You don't use those keywords to refer to functions that are contained in other source files that are linked with the project. in main.c you need to prototype the function that is included in a different *.c file using extern keyword. Below is an example how to do this in main.c -- do the same thing in each of the other *.c files.

// main.c file
#include < header files here>
extern void callfunc();

One of the *.c files you link with your program must contain the code for callfunc().

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

Heck, C is better than C++ for reports...

I recently finished a project that prints one of 25 reports. The program runs in MS-Windows XP server, each report requires getting data from a Sybase database located on another computer, formatting the data, then printing the report on one of several lazer printerss. Yes this could have been done in C, but C++ classes I found on the net made my job a whole lot easier. The program can not just simply output some text to stdprt or lpt1: because (1) the printers are not located there but they are no a network, and (2) the reports contain a lot of line drawing code that requires win32 api DCD line drawing and font functions.

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

here is how I would code it.

cout << "The string reversed: ";
for (i = strlen(reversedUserInput)-1; i >= 0; i--)
{
// print the [b]ith[/b] character
    cout << reversedUserInput[i]; 
}
cout << "\n";
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

strcpy() function does not take 3 parameters --

strcpy(reversedUserInput, userInput);

>>for (reversedUserInput; i >= 0; i--)
This is incorrect. you have to initialize variable i with the length of reversedUserInput string minus 1 (because of null terminator)

for (i = strlen(reversedUserInput)-1; i >= 0; i--)

>>cout << "The string reversed:\n" << reversedUserInput << endl
This is incorrect too. It will display the entire string in normal order (not reverse order). It should print just one character on each loop iteration.

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

please post code so we don't have to guess what you are doing. But basically its like this

char string[] = "Hello World";
int len = strlen(string)-1;
while(len >= 0)
  printf("%c",string[len--]);
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I would say, it goes out to show that there is always a correct language to use in a given situation, and that that is not neccessarily "the most powerful language".

I agree -- for example I would not think of using either C or C++ to build Office Automation projects -- much simpler and faster to use VB Scripts for that. We tried using C++ to build a slide show project and the programming became horribly complex. Also C/C++ is not very good for reports -- COBOL (how do you spell Yuk!) is better for that.

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

you need to add the parentheses so that the compiler will know it is calling a function.

randomno = randgen(); // Generate random number

>>it has a variable double register random
do you mean you declared it like this ??:

register double  random;

All of the compilers I have used over the years only allow register keyword for integers (short, int and long). And today most compiler will ignore the register keyword altogether. There is no requirement for a compiler to honor that keyword.

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

I don't like the American version of football -- too dull, uninteresting and brutal. European football (what we call socker) is a lot more exciting.

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

Hello all, It is my first post :) I want your thoughts on this: Do you feel that because your parents may have supported you when you were younger, that you "owe" it to them to support them now? (Pay the bills they run up etc, just because they did it for you when you were younger and unable to work) Thanks.

No, at least not until the parents get really really old and can no longer support themselves. Its not your fault you were born -- :rolleyes:

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

>>there is a tool i need to have to make it work

please tell us that tool you found??? I'm not at a linux computer right now, but I think all you have to do is use escape character

sh: ./a.out \* <Enter>
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>You attacked VB programmers in general, implying that their art is "child's play"

Isn't it? Any 10 year old child can program in that language. Most real professional programmer would not be caught dead using VB. But that attitude may change in the future with VB .NET because it can be freely mixed with C, C++ and C# to make a complete program.

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

don't know why you would want to do that it will just make your program more difficult, but you could create arrays of each object now is the structure. Lets say you need arrays of 255 items.

pid_t pid[255];
int length[255];
char buff[255][128];
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

since this is a normal windows program you could replace sleep with a timer (see SetTimer() in MSDN) that is triggered every xxx milliseconds, and move call to refreshAutoAway() inside the timer event handler. Then replace that loop with the message pump, calling PeekMessage(), which will block your program until a windows message is received.

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

Please ask specific questions -- doesn't it compile? If not, why? Doesn't it work right? No, then what is wrong with it.

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

what was the error? please copy from window and paste to your post.
Since you are subclassing a standard MFC control your dll should be an "MFC Extension DLL". I have never successfully exported that type of class from a regular DLL.

Also, I suspect you did not import the class correctly into your application program. I use a macro and define it to be export when compiling the dll and import when compiling the application program. This will export the entire class, which is what I think you will need to do.

#ifdef MYDLL // call this whatever you want in your dll, do not define it in application program
#define DllExport  __declspec( dllexport )
#else
#define DllExport  __declspec( dllimport )
#endif

class DllExport AFX_EXT_CLASS ListCtrl :public CListCtrl
{
public:
    ListCtrl();
    ~ListCtrl();
public:
    DECLARE_MESSAGE_MAP();
public:
    afx_msg void OnNMClick(NMHDR *pNMHDR, LRESULT *pResult);
};
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I think everybody hate when his phone/mobile ring, you pick up and hear that you just won some kind of Grand Price.

That really makes be glad I do not own a cell phone:mrgreen: I get enough commercials from TV, radio and spam e-mail. I don't have to put up with spam cell-phone calls. And I think I heard YOU, the victim, have to pay for those calls.:eek:

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

prints all the files in the directory instead of *.

need to print * , and not all the files in the directory.

are you sure you know what you want the program to do? We can not help you if you do not know either.

unable to understand it

I can understand that -- but getting a list of all the files in a directory is not an easy solution. An alternate way of accomplishing that is to open a pipe to the shell's ls command, which will return the files and other info just as if you typed ls on the command line.

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

Here is an interesting discussion I found -- you may have already seen it.

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

Great avaitor! I feel like that quite a bit.:mrgreen: :mrgreen:

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

Here is one I found on the net using google -- use it at your own risk because it contains a couple bugs, but otherwise I think it is what you want.

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

Ubuntu may be ok for just casual users, but is terrible for c/c++ programming. I tried it on my computer, easy to install but does not include any developers tools such as GNU compilers. I now use fedora 5 which is a lot more complete. Don't know anything about the other versions of linux.

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

>>Can someone please finish this off,

No, we don't do your homework for you.

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

why are you responding to a year-old thread??:eek: :eek: I doubt the OP is interested in it any more.

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

This thread was moved to the Java Forum so no idea what it's doing here.

You should have received a PM from the moderator that moved this thread. If you did not, then most likely you posted it in the wrong board by mistake. If that is the case then we will be happy to move it to that board -- just ask.

I've never ever done programming before in my life

You might buy an Introduction to <whatever language you want to use> book that will show you the basics of that language. I don't know the first thing about java so I will be of no use to you, but there are a lot of others who can answer specific questions about the language.

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

you probably should turn off antivirus software and firewalls, then try to install again.

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

>>C and C++ should be abandoned
you don't have to use C/C++ if you don't want to, but don't expect everybody else to do so. Writing windows GUI programs is just a small part of the software design/programming efforts. And in some operating systems C and assembly language are the only two available programming languages. We can't just toss out a computer language just because some one doesn't like it.

>>I think future operating systems should use a no kernel approach where all processes run in the same memory space

That has already been tried -- see MS-DOS. A kernel is an absolutely essential part of any operating system, if there is no kernel then nothing will run and the kernel needs to be protected from corruption by other programs.

>>If arbitrary pointer control is not possible in the default language, protected mode addressing is not necessary

That is not true. There are a lot of other things that can cause a system to crash; pointers is only one of them.

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

what version of MS-Windows is your computer running? I assum you are tring to install VB .NET 2005 (Express edition?) Go back to the Microsoft download page and read about system requirements -- make sure your computer meets or exceeds those requirements.

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

can u please post me what is written in the link , i am unable to open it .

The article is probably copyright. But you will get similar articles by googling for "man opendir" which will give you links to the linux man pages for that function.

Here is another example

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

i m wrking on linux

see this article

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

Now that you posted the requirements of the program, what do you want from us? We will not write your program for you.

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

you can read it liike this

while (theFile >> temp >> windspeed)
       {
           // blabla
      }
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

depends on the operating system -- *nix or MS-Windows? (MAC I don't know about). I believe there are some boost c++ classes that will make your code portable between operating systems.

MS-Windows: FindFirstFile() and FindNextFile() Here is a code snippet that illustrates how to use these functions.

*nix: opendir() and readdir()

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

>>if (check = true)

you should use == boolean operator here, not the assignment operator.

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

move all the code that is in main into a different function -- just rename main() to something else. Then create a new main() what has a loop that calls that function

int some_function()
{
   // blabla

   return < 0 to end program, or non-0 to continue >
}

int main()
{
    while( some_function() != 0)
          ;
    return 0;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

There is lots of on-line help for the pow function -- such as this one.

while (theFile >> number)
{
   cout << number << "\n";
}

that will read every number in the file, assuming the file contains no other strings. The program will store evey number read into the same variable, so you will have to save it somewhere else if you want to use it for something else.

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

I hate to say this, but you can start by reading your textbook and paying attention in class. We have no idea what you are supposed to do either because you did not mention what computer language, operating system and/or compiler you are studying. Once you have figured that out then you should post your questions in the appropriate board.

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

What he posted does compile ok after fixing minor posting errors. But the problem lies when attempting to pass a double to the push method instead of a pointer, such as

weight.push(student.weight); // error
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

If you expect an answer you will have to post some code and show your attempts to solve the problem.

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

The problem occurs when you try to use that stack class to maintain doubles instead of pointers. It doesn't work because push() expects a pointer and not a double. It would make more sense for the stack class to maintain pointers to instances of the entire records structure instead of its individual members. Then whoever calls pop() will get a pointer to a records object and can do with it whatever it wants.

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

your program has at least two problems I can spot

int push(void *myobject) 
{
records * layer= (records *) myobject;
}

What is the above supposed to do? all it is doing is typcasting myobject from void* to records*, then does nothing with it. Its a "do-nothing" function.

void* pop(void) 
{
return layer;
}

Above does not do what you probably hope it does -- variable layer is an array of pointers and that pop function is returning the entire array. It is probably only supposed to return the current element in the array.

Look at the pop() function I posted to see how that should be accomplished.

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

>>1. I don't know why when I enter the number in, when it prints out the number

which function has that problem?

>>2. I don't know whether my checking part can really check the numbers have repeated or not

Why not make that check at the time a number is entered, then you won't need another function to do that.

And BTW: Thanks for using code tags to make your program easier to read. :)

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

A couple observatons:
1. variable font needs to be a member of a class and not allocated on the stack so that it will not get auto destroyed when the function returns.

2. You probably need to typecase it

GetDlgItem(IDC_FONTID)->SetFont(reinterpret_cast<CFont*>(&font));
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I see we can get it as a screen saver too! Looks like it would be worth the $50.00 or so.

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

Thanks, but I need only 96 characters, not 255.

The maximum number of characters that someone will enter is 96. This is not the same as the actual value of the characters. The array I mentioned can handle any key you can type on the keyboard, plus a few you can't type. It doesn't really matter that the array is actually larger than you need. If this were a c++ program I would have suggested a better method (map), but you are explicitly instruced to not use any library functions.

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

there are 255 characters in the ascii character set (only about half are printable), so all you have to do is create an int array of 255 and use the char as an index into that array. When all done, loop through the array and print out the values for items greater than zero.

int array[255] = {0};
//
//
char c = 'A'; // assume letter'A' was entered
//
// increment array
++array[c];
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I would input everything info one big string then parse the string to find out how many words where are. If it contains the correct number of words then it can be broken into its individual parts.