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

I have never found a need to copy the vtable in any of my c++ programs. I normally use Microsoft compilers and have never encountered a vtable problem with them. If you use a compiler that has such a problem then get yourself a different compiler.

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

>>ifp=fopen("in.txt","r");
That is opening the file in text mode while fread() expects binary mode. Suggest you replace fread() with fgets() if you want to keep text mode.

>>fread(text[0],sizeof(char*),1,ifp);

sizeof(char*) is always the sjze of a pointer, which on MS-Windows and *nix 32-bit compilers is 4. And that's why fread() is only reading 4 characters.

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

Another forum I visited merged multiple consecutive posts by the same person.

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

Have you already written the server and you just want to port it to MS-Windows?

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

use ifstream. Assuming status is a file and not a directory it would be like this

#include <fstreeam>
using std::ifstream;

int main()
{
   ifstream in("./proc/1/status");
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

If you ask really really nice you might ask one of the mods to remove the code you posted, leaving the rest of the post.

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

Your question is a little fuzzy -- what kind of object do you want to create when the time is entered? Are you talking about a clock?

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

Jesus just give the people what they want write the fucken code for them, or better yet since the douchebags on this forum don't want to give the answer go to cramster where they will write the code for you

Oh that's a great way to teach people how to program. I suppose if you every get a job you will expect eveyone else you work with to do your work for you so that you can sit on your ass and play with yourself.

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

>>Our professor ask us to upload our program in a website, I've been searching through the web with possible ways, but I still can't figure it out how to do it.

Whose web site? The professors? The web site should have a link to upload files to it. If you can't find it then you should ask your professor.

>>There's another problem, I a trying to run the "Application file" inside the Debug folder
Very comnmon problem for new programmers. You have to put something at the end of main() to keep the program from closing so that you can read whats on the screen. There are a couple options:

  1. Just before return in main() add this: cin.get(); Assuming the keyboard buffer is empty that will cause the program to wait until you press a key.
  2. Create a command prompt (DOS box) and run the program from there.
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I don't know how to do it with dev-c++ because I don't use it any more. Look around the options, there should be a place where you can enter the library names.

What OS/SP are you using?

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

Check the compiler output screen to see if it recognizes thse pragmas. I know those functions are in ws2_32.lib. Its possible the pragmas were ignored.

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

Instead of someone posting an example you should post what you have tried.

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

It does point to an array. What I posted is the general way to pass arrays as parameters. What you posted will work too, but the & address symbol is not necessary because all arrays are passed by reference (or by address), never by value.

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

I know of at least one library that has command-line make files which support multiple compilers on both MS-Windows and *nix. The authors of such libraries created a makefile for each compiler they decided to support. Its quite a task to keep all those make files synchronized.

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

You can use / in both MS-Windows and *nix. C:/foo/bar.dat

If you still want to use \, then the only time you need \\ is in string literals which are surrounded by quotes. Paths read from a file or returned by some other function do not need \\.

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

Try setlocale()

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

Maybe this will help you

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

In C and C++ there is a register keyword, but most (if not all) compoilers just ignore it for reasons previously stated. And even then register can not be used with global variables.

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

Is that function a member of a class? If yes, then in the *.cpp file you have to identify the namespace in which it appears as well as the class name, something like this:

#include "contacts.h"
namespace MyNamespace // or whatever its called in the *.h file
{
   void MyClass::loadCustomerDetails()
   {
     // blabla
   }
}
kvprajapati commented: AD, Its Managed VC +11
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>lblName->Click += gcnew System
You do NOT use += in that line, just =.

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

The reason is that there are only a limited finite number of resigers available to the program. For example on Intel and compatible processors there are only 6 register variables in common use throught the program (eax,ebx,ecx,edx,esi and edi), so it would be impossible to store global variables in them.

vedro-compota commented: +++++++++ +1
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

If your program is calling OpenFileDialog() then you need to set the RestoreDirectory property to TRUE so that it does not change the current working directory on you.

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

you are using the same fstream object to do both reading and writing. That is ok, but you have to call seekg() between the two in order to reset the file pointer back to the beginning of the int that was written.

[edit]Or use ifstream and ofstream as ^^^ suggested.

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

No -- that will only be the beginning of the changes you need to make. I wouldn't expect there will be very many changes because there are a lot of similarities between the two. In MS-Windows you will have to initialize the socket library and you will find out how to do that in one of the tutorials you need to review.

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

Yes, it is a little different than what I originally thought -- its actually a lot simpler. Convert hours to days just divide hours by 24. The remainder of that division will be the excess hours.

int hours = 123; // you enter this value
int days = hours/24;
hours = hours - (days * 24);

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

Here is the real solution

char  anArray[32]= "123456"; // <<< This is how to initialize the array with some text
      
 
// char*  pAnArrray = anArray; <<< This is an unnecessary pointer
// the function call 
 
someFunction(anArray) // << this is how the array should be passed to a function
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Its crashing when extend() is called from the class constructor because you failed to initiailze class variables before calling that function. Line 65 is trying to delete an ininitialized pointer. That is bad regardless of what compiler you used.

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

One way to make the cod eportable between both *nix and MS-Windows is to use preprocessor instructions, something like this:

#ifdef _WIN32_
#include <winsock2.h>
#else
include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <errno.h>
#endif
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Hopefully you will not need to make very many changes to the source code. MS-Windows uses winsock instead of berkley sockets, so you might want to skim through one of the tutorials to see what changes you may need to make.

As for MySql, I don't think you will have to change anything.

What you have to download and install on MS-Windows:
1. A compiler, such as Code::Blocks or VC++ 2010 Express, both are free. Both compilers come with everything you need to write your socket program(s).

2. MySQL server so that you get access to the header files and libraries.

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

Sorry, I can't help you because I never used Perl.

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

i think you willingly did a mistake writing 19000
is it just 1900?

It was a typo. 1900 is correct.

please can u explain the functions used in it....

There is only one function -- learn to use google for stuff you do not understand.

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

Such a class would keep all the digits as a vector, array or linked list of characters, and you could make it so that it has no upper or lower limit to the number of digits it can hold.

>>May you get me started?

Certainly -- here goes

#include <string>
#include <vector>
using std::string;
using std::vector;

class INT
{
   INT& operator+(INT& i);
   // other operators here
private:
   vector<char> digits;
};
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

On MS-Windows I use either VC++ 2010 Express or Code::Blocks. On *nix (rarely) I use Code::Blocks. Never had a reason to use Eclipse. In the early years of programming (1980s and 1990s) I used a text editor, something like Notepad or VI and compiled everything from the command line using eiher batch file or makefile. That was before IDEs became so good.

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

Those header files are used on *nix machines. MS-Windows does not support them. just include winsock2.h and ws2_32.lib for sockes on MS-Windows computers.

And replace that obsolete Dev-C++ compiler/IDE with Code::Blocks or VC++ 2010 Express, both are free and current.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
#include <time.h>
#include <stdio.h>

int main()
{
  int day = 1;
  imt month = 2; // February
  int year = 2010; // year can not be before 1900
  int days_to_add = 123;
  struct tm tm;
  // initialize the structure
  memset(&tm,0,sizeof(struct tm));
  tm.tm_year = year-19000; 
  tm.tm_mon = month-1; // 0 = Jan, 1 = Feb etc
  tm.tm_mday = day;
  tm.tm_hour = 12; // fictious
  tm.tm_mday += days_to_add;
  mktime(&tm);

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

Here is a pointer tutorial from DaWei

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

An easy way to find out if the problem is your new program is to run it from the command prompt and redirect the output to a file, such as c:\myprogram >myfile After the program finishes check the contents of the file to see if it contains the data you would expect.

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

After getting the date and number of days, use functions/structures in time.h to do all the hard work. First populate a struct tm with the year,month and day from keyboard input, then add in the number of days to mdays field of the structure. Finally call mktime() and it will normalize all the fields.

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

There are a couple of ways to delete a book from the library.
1. Rewrite the entire file, and omit the book that is to be deleted.

2. Mark the book to be deleted so that other functions just simply skip it when reading the file. One way to mark the book is to set one of its attributes to something that can not be used, such as change the value of number to -1.


To modify a book. Since you chose to write the file in text mode, where each field has variable length, you really have no choice but to rewrite the entire file and make the change(s) to the book as you write the file. This would have been a lot easier had you chosen to write the file in binary mode where the size of each book in the file is the exact same size.

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

You can not open the same file twice. Use just one FILE* pointer and open it for both reading and writing if you need to.

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

I think everyone needs to marry after being eligible for getting married. Marriage may be everything for a person. because of this, man can do his task very easily and can keep his mind fresh from any bad things. If you become a noble person, you marry anyone quickly.

Advice like that is one reason there are so many divorces. Its a proven fact that people who get married younger than 21 are more likely to get divorced than those who get married at older ages. Get married for love, not for lust.

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

study up on how to create threads. How to do that will depend on the operating system you are using.

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

Have you studied structures and linked lists yet? If you know structures, then create a structure that contains two items: the double value and an int count of the number of times the value occurs in the original list. Then make an array or linked list of that structure. You would only run through the original double array once, but you will have to run through the array of structures multiple times.

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

Well then buy a book on assembly programming or read some online tutorials. Anything is better than blindly guessing.

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

You most likely have a project that contains two or more *.cpp files, and two of the files have main() defined in them. Delete the one you don't want.

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

line 51: strcmp() returns 0 when the two strings are the same.

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

Why are you just tossing int instructions around hoping that someday one of them might work????

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

int instructions only work for the interrupt functions that are pre-defined by the operating system. printf() and scanf() are not define by the os api therefore it's not possible to perform int instructions to access them. Those are higher-level functions defined by the C language. google for int 21 instructions and you will find a list of all available functions for int 21.

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

You figured correctly.