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

What are the error(s) you got? The code you posted is not overloading any functions.

line 3: remove the {} characters because it makes the function an inline function. It should look like this:

virtual void created();

line 10 is wrong. Remove the word "test"

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

Do you know how to connect and use a database that is on the same computer as the program you need to write? Once you get that going moving the database to a different computer is trivial. It's all in the connection string, just add the IP address of the compute on which the database is located.

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

I bought a Galaxy Note3 the other day. Pretty pricy but pretty nice too. Nice big clear screen that's good on my old eyes. This is my first smartphone -- it's a little like moving up from horse & buggy to a Ferrari :)

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

Just select some text from this post and wait for a pop-up to appear.

I don't get any popups.

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

Linking MS Access to C++ is not using console program but a GUI .NET program. It's useless for console programs.

Other ways to do it is c++ odbc and ADO

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

An Android app!

Most of the forums I visit are based on vBulletin. DaniWeb is already better than any of them.

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

Hummm -- where is there an "Insert with the Quote editor button"? I can't find it.

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

line 4: the loop won't work because it's checking if the character string[i] is the same as the first character in pon1. Let's assume the character at *pon1 is the letter 'a'. How many instances of 'a' do you think might be in the string??? There could be lots of them, so testing for string[i] == 'a' will likely be a false positive hit.

What I would do is just truncaqte string at pon1 then you can just simply strcpy() string into stringnew

*pon1++ = '\0';
strcpy(stringnew,string);

At this point you need to move pon1 pointer to the end of the characters that are in name. Example, if name == "time" then increment pon1 until it is one character beyond the end of the word "time". Now you will have the start of the last part to be copied into stringnew array. You can call strcat() to copy all the characters from pon1 into stringnew.

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

I do it without shifting by using a temporary character array. After calling strstr() to find the beginning of the word or string you want to replace, copy the original string from the beginning to the position returned by strstr().

For example, If the original string is "Now is the time for ..." and you want to replace the word "time" you would copy "Now is the " into another character array.

Next, add the word or string you want to replace it with, if any. Lets say you want to replace "time" with "moment". You would concantinate "moment " to the end of the temporary character array.

Next step is to add all the remainder of the original string to the temp character array. In this example "for ...".

At this point the temp array contains "Now is the moment for ...". Now you can do anything you want with this temp array, such as copy it back to the original buffer (note: you can not copy back over a string literal.)

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

What version of MS-Windows and what version of IE? I had problems with IE10 on Windows 7 so I downgraded to IE9.

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

I thought the first two sentences of Reputation tooltip was confusing at first -- didn't see the relevance of "Vote on posts. Leave a comment", but eventually realized that is telling us how reputation is changed by "Vote on posts AND leave a comment".

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

fprintf(file, "%d""%s" , array[i], " ");

Why %s when all you want is a space

fprintf(file, "%d " , array[i]);

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

You can't, at least not in just one line. printf() does all the formatting for you. If you want to use fputs() then you will have to do all the formatting yourself. Much simpler to just use fprintf()

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

wth are people still trying to use turbo C

Because many universities are too damned ignorant and lazy to upgrade their skills. And they have the nerve to call themselves institutions of higher learning!!

and oh, learn English

I don't have a problem with bad English grammer from people whose native language is something else. Last time I knew DaniWeb wasn't just for English majors.

ddanbe commented: Well said. +14
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You're getting what error?

Function prototypes just tell the compiler about the function's return values and parameters. An easy way to create a prototype is to copy the function header and add a semicolon at the end.

int searchEntry(indexs ind[],char key[],int n);

Can we use Fopen in C++?

Yes, but you should probably change all functions/structures in stdio.h to fstream declared in <fstream> header file. If you don't know how to use fstream then search for tutorials -- there are lots of them. Here is one.

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

I bought a new Galaxy Note3 the other day. Last night I thought I'd use it to browse DaniWeb. Big mistake -- DaniWeb is viturally unusable on Android because the purple menu at the top covers the entire screen except for about 1/2 inch at the bottom and the purple ribbon at the bottom uses most of that space.

Is anyone working on a Mobile Daniweb app?

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

Here it is as a class

class foo
{
public:
    void Scanned(ifstrem& ifp,int i);
    void Read(ofstream& ofp);
    int  Checker(std::string s,std::string u);
    void Stored(fstream&);
    void Printed(ifstream& ifp,ofstream& ofp);
};
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Life is sometimes curel and inhumane, if you don't want to watch it then don't. Most of those Al-Qaeda animals could care less about human life. And least we forget, our countries have a lot of sickos as well.

Here is an article about recent cannabilism reports. A couple of songs have even been written about one of the cases.

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

The second parameter must be a web address, like in the examples in this article. Why would you want to use that function just to copy a file from one place to another on your own computer?

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

But where does that stop? Should authorities be able to shut down a web site just because some people find it objectionable? So far that hasn't stopped the proliferation of porn sites. It's a bit like free speech -- I may not like what you say but you have the right to say it.

I wouldn't read too much into what people say on those types of sites anyway. They all know they are anomonyous posters so they say almost anything that pops into their sick minds. Would they do it in real life? Changes are, no.

jwenting commented: well said +0
Mike Askew commented: Nailed it. +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Of course it's possible. Just get (buy) Microsoft Visual Studio 2013 (there are probably other compilers too) and you can write as many apps as you want. That doesn't mean any of them are sellable. The best part of writing mobile apps is GOOD DESIGN, not programming. You can be the world's best programmer but if you don't have a good design then all your effort will be for nothing.

If you want to see your competition just google for "Best Mobile Apps" and you will find a PC Mag article that indicates there are over 800,000 apps for Android just on Google Play! Do you have an idea that will put your app near the top of that list? Or even in the top 100? If you do, Great :)

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

depends on the operating system.

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

Do you have 32-bit or 64-bit version of MySQL? Check the program's platform to make sure it is the same as version of MySQL. If they are different you will have to change the program's platform 3c2f9dffecb4c334156fc0bf546aed5c to match the library you are trying to link to.

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

I'd recommend writing the value of the variables to a text file, and tag each value with the name of the variable. That way you can change the program to add more or remove some variables without changing the format of the file. An old *.ini file format is good for that, for example

[Mary] // player name
a=123
b=345
c=789
doorNumber=1
[DonkeyKong] // another player name
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Yes, I lost my mind there for awhile :) Use of an array would be more efficient only if the search were required more than one time. Once the array is built it could be searched as often as needed.

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

Like when u say "conio.h is not supported", so compiler doesn't support ? How can it be ?

conio is not a standard compiler header file. It was originally created by Borland in the 1980s for their Turbo C compiler. Read this wiki article to get more info about it.

The only header files that all C compilers must support are listed here. Anything not listed are non-standard and it's up to the compiler maker whether to support them or not. Almost all non-standard header files also require a library that contains the implementation of the functions in the header file. You generally can not use a library that was generated with one compiler with a different compiler. For example libraries generated with Borland compilers can not be used with Microsoft compilers for two reasons:

  1. The function naming convention is different
  2. Function calling convention is sometimes different.
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

you didn't declare the variables you used. You have to declare all variables before they can be used, for example:

float a;

If you don't know what "float" is then you should read up on C Language Data Types.

line 7: the = is an assignment operator, the == is the boolean operator. If you want to compare a with something them use ==.

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

Code::Blocks with MinGW compiler is the IDE/compiler I recommend for new programmers because it's not nearly as difficult to learn as Microsoft Visual Studio. Also because at some point you will probably want to move on to *nix, VC++ is only supported on MS-Windows while Code::Blocks is supported on both operating systems.

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

One way to do it is to create an array of pointers, each pointer points to a node in the linked list. Then sort that array of pointers, swapping the data in the nodes of the linked list, not the pointers. If each node contains several data items then change the node to use a structure so that the structures can be swapped all in one shot instead of swapping each data item individually. The array can be destroyed after sorting is complete.

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

2 - why some people adive me use '{' after function\class name and not in next line?

I used to put { on the same line as function/class name, but was often difficulty to match { and } braces, so I started putting { on the next line all by itself. Now with that and indentation matching braces are usually easy to spot.

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

Guys although i appreciate the posts, I asked for anything I could do to increase the chance of getting a job outside going to Uni - not a number of posts telling me why I should go to Uni.

google for "freelance programming", there are several sites where you can bid on jobs. Or try some temp agencies where you get paid only if they assign you to a job (which probably will require an interview with the prospective client).

Other than that you are pretty much at a dead-end without a university degree. There was a time 30 years ago when the job market in IT was wide open and people could easily get jobs without a degree. But that was 30 years ago and times have changed.

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

I believe I could learn more in 3 weeks at my computer than I could in 3 years taking Computer Science.

That may or may not be true, but why deny yourself an education when you have the choice of either putting yourself on the same level as your competition, or setting yourself up for a do-nothing and go-nowhere career. Competition in IT is very stiff, there are lots of people who gladly graduate from college so that they get their foot in the door for a profitable and rewarding career. Without that, your career will go nowhere. Why should any company hire someone who has no formal education when there are lots of other people looking for the same job who have bachelor degrees? Your reasoning for not wanting to go to collete is just plain stupid.

I know a lot about programming and know around 5 languages, and have a vast knowledge of tons of different areas

That means almost nothing when it comes to entry-level jobs. Just because I know how to use a hamnmer and saw doesn't mean I will be any good at building a house. Get an education.

Once you have enrolled in college you can probably take bypass tests to skip and get credit for knowledge you already have.

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

I bought a new Galaxy Note3 a couple days ago and experimenting with various rintones. I noticed most of the free ones are pretty sad -- except for this one "An idot is trying to call you". LMAO and so did my kids when I let them hear it.

Anyone know where I can get better funny rintones?

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

virtual void printf(); means you are going to implement the function in the *.cpp file instead of inlining in the class.

virtual void printf() {} is a do-nothing function, the function name exists but does nothing because there isn't anything betweein the two braces { and }.

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

You should remove virtual keyword for functions that are not inhereted from parent and from the function in parent that you do not intend to overload in derived class.

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

what makes you think it isn't executed? Did you use a debugger or put a print statement inside the constructure to see?

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

Windows has a terrible habit of adding extra bits to the end of file names, and then hiding it from you;

I never had that problem. But you are right about the spelling -- capitalization is not important on Windows but the file name must be spelled correctly.

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

what compiler are you using? I get several errors from VC++ 2012, for example on line 59, can not initialize within class declaration. Check your compiler errors and fix them.

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

Created() function without nothing and can be changed outside of class

It can not be change by anything outside the class unless it is a child class of the class in which Created() is declared. Then it's called inheritence. For example you inherit certain traits from your parents, but you can not inherit traits from a neighbor who lives down the street (unless he/she is one of your parents). Same idea in c++ classes

class foo
{
public:
    virtual void Created();
};

class bar : public foo
{
public:
    virtual void Created();
};

int main()
{
     foo f;
     f.Created(); // calls Created in class bar
     f.foo::Created(); // call Created in class foo
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

IMO you need to rethink how you are implementing this. You should have only one class that does serial port stuff, not two classes unless the two classes act as one class. One of the members of the class could be the serial port number so that the instance of that class can be assigned to a specific serial port. There are serial port cards that support anywhere from 4 to 64 (or more) serial ports on the same computer, and you wouldn't want to create a new class for each of them.

Second, you should have each instance of the serial port class in its own thread so that they can all work concurrently.

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

The string is still uninitialized garbage. How do you plan to test your program to find out if it works or not?

How about now?

Don't ask me -- test it yourself on your computer and see if it does the job correctly or not. That's called "unit testing" and "debugging". It's your job to do those things.

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

First of all, extract has to contain a valid string. What you have is a chracter array that contains random junk. Initialize it something like this:

char extract[80] = "Hello World";

Read the instructions I posted carefully, the last paragraph is what you want. You did not initialize the two integers correctly. And don't put strlen() inside the loop!

for(int j = 0; extract[j] != '\0'; j++)

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

Easiest way is to use two pointers. The pointer to the source string startgs at the beginning of the string. The pointer to the destination string starts at the beginning of the destination character array plus the length of the source string + 1. You need to the +1 in order to add the NULL string terminating character.

After setting that up, just create a while loop that loops until the source pointer reaches '\0'. On each loop iteration you increment the source string pointer but decrement the destination string pointer.

You can accomplish the same thing by using two integers instead of two pointers, such as i and j. Initialize i with 0, and j with strlen(source string) + 1. DO NOT calculate strlen() on each loop iteration because that takes too much computer time. Just calculate once before the loop is started, from then on increment i and decrement j.

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

It is impossible for any human>

Zombis :)

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

After you enter an integer you press the Enter key, right? Well, scanf() doesn't remove that key, so it remains in the keyboard buffer.

When you enter a number, scanf() will ignore white space until it reaches the first numeric digit then stop reading the keyboard when it reaches a character that is not a diget.

When you enter a string, scanf() reads all the characters in the keyboard buffer until it reaches the first white space character (space, tab, carriage return, linefeed). So if you previously called scanf() to enter a number, such as "%d" and then call scanf() again with "%s", the first thing scanf() finds is a white space, so it will do nothing.

C-language has no good standard way to clear everything from the keyboard buffer. The easiest way to remove the '\n' from the keybaord buffer is to call getchar() after each call to scanf() with "%d".

shahab.burki_1 commented: Thanks-- the getchar() worked +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

After you cd to where you think Motto.cpp is locted, do dir command to make sure the file is where you think it is. The file needs to be in the current working directory.

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

it looks quite modern to me !

Except for the black MS-DOS-look editor. Looks like ancient Turbo C editor, which was written 30 years ago for MS-DOS 6. They just added a menu on the left side of the window.

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

Sorry, I don't like the looks of it -- looks like something from the 1980's. Notepad++ is much better.

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

Just happened to me again here. I had to refresh the screen 4 times befor Edit Post displayed the correct text. After that it worked ok.

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

What operating system are the computers running? Are the computers network cabeled or wifi? How about the environment -- fairly quiet like an office or very noisy like in a manufacturing facility? I've known noise to interver with cabled systems, don't know about wifi. Electrical lines (wiring) may also cause interference (see testers).