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

On line 14 use && (and) operator instead || (or) operator. You want to find out if str is not equal to str1 AND if it is not equal to str2.

But strcmp() does a case sensitive comparison, meaning that Yes is not the same as yes or yEs or yeS. You should use a case insensitive comparison. One such function is stricmp(), which may not be available on all compilers. Another way to do that is to convert the entire string to either upper or lower case, depending on the string that you want to compare it with. To do that just loop through the string and call toupper() or tolower() for each character.

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

Yes, we all do. The error message already told you to call strcmp() to compare two strings.

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

Go to google, find OpenOffice, get the source code, and send it to your teacher xD

LOL, and get an F. To OP: seems like you have already been given lots of advice so the next step is up to you. Start designing the program and code its features one at a time, and a little bit at a time.

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

If NewButton2 is referenced in NewButton1.h then NewButton2.h must be included in NewButton1.h Your problem sounds like you just need to get the includes in the correct order.

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

The first row in the file is 500,000*4 or 2,000,000 bytes long. So the first column of the first data row starts at position 2,000,002 (CR/LF line terminator). The beginning of the second column first data row would be 2,000,002 + 3 (2 characters + 1 space). The beginning of the first colum second row would be 2,000,0002 + (3 * 500,000) + 2 = 3,500,004.

The beginning of the last column on the last data row would be 2,000,002 + (299,999 * 3 * 500,000) + (299,999 * 2). That's a pretty large number so I think you will need to use a 64-bit integer.

All other calculations are similar to those I described above. If I were you I would write a very small program to code and test the algorithm for many different column numbers. Once you get the algorithm and formula correct you can add them to your larger program.

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

You need to use the UPDATE SQL statement, not the INSERT statement.

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

If you have tried then post your attempt so that we can help you.

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

Depends. Offhand I'd say it will require 100% rewrite because java doesn't have access to .net framework. But good news -- here is a bridge between the two

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

I would agree but the file must be read as binary data using read() instead of as text, unless the OP wants to change the way the file was written.

ifstream f("saved.txt",ios::binary); // open in binary mode

while( f.read((char *)&ab, sizeof(patient) )
{
   if( name == ab.name)
   {

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

line 13: remove pos+1

line 20: add pos+1 in the substr

The two lines mentioned above are conflicting with each other.

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

Is your computer running a good antivirus program?

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

Sounds as if he is writing a GUI program and calling win32 api GetOpenFileName() standard dialog box. If that is the case then that dialog box will return the full path in the structure you pass to it.

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

>>if(!(strstr(name, ab.name)))

line 55. strstr() does not compare two strings to see if they are the same. Instead, strstr() tries to find one string from within another larger string. What you should use here is strcmp(), not strstr(). strcmp() will return 0 if the two strings are exactly the same, including case. "John" and "john" are not the same because of capitalization. Use stricmp() to compare ignoring case.

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

Is the problem with certain browsers? I use Chrome and Windows 7 now and I have no problems like that at all.

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

I haven't experienced the problem tonight but maybe I'm just lucky tonight :)

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

can't really say the problem without seeing main.h. You probably did not write the implementation of those methods. In any event, get/set methods should not be static because static methods do not have access to instance data.

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

what operating system are you running? If *nix then use debugger named gdb and it will tell you where the error was by reading that core file.

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

If you use CreateProcess() instead of system() to spawn Notepad.exe then CreateProcess() will give you the thread id.

Here is an example. The PROCESS_INFORMATION structure will contain the data you are looking for.

#include <Windows.h>
#include <iostream>
using std::cout;

int main()
{
    PROCESS_INFORMATION pinfo;
    STARTUPINFO sinfo;
    memset(&sinfo,0,sizeof(sinfo));
    sinfo.cb = sizeof(STARTUPINFO);

    if( CreateProcess(NULL,"Notepad.exe myfile.txt",NULL,NULL,
            FALSE,0,NULL,NULL,&sinfo,&pinfo) == 0)
    {
        cout << "Error calling Notepad\n";
        return 1;
    }
    return 0;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

My bet is that you copied some code from the net that was written with VC++ 2010 Express and you are trying to compile it with gcc???

_TCHAR is a macro defined in tchar.h. You can just replace it with char* so that the line looks like this: int main(int argc, char* argv[])

justin96b commented: Thnx - its fixed, +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>string_size = sizeof(argv[count]);

Line 20 of main(). sizeof returns the size of the argument, not the length of the string. Since argv[count] is just a pointer, sizeof(argv[count]) is the same as sizeof(char*) which is normally 4 on most 32-bit compilers today.

What you probably want is string_size = strlen(argv[count]);

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

why is menu() doing recursive calls in each of those case statements? There is no need for that and those lines should be deleted. The program will return back to the top of that while statement without doing recursion.

Line 113 (return) is not needed either. The loop will just stop when '6' is selected so there is no need for case 6 -- that case will never get executed.

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

Are all the columns the same width? What is the width of each column (number of characters)? If each column were 2 characters wide, then 500,000 columns would occupy about 1 meg memory. But if you know before reading the file you only need two or three of those columns then those are only the ones you need to keep in memory. Reading that huge file into memory will be ungodly sloooooow, actual time will depend on the operating system and disk access time of the hardware. *nix is faster at disk access then MS-Windows from what I've seen my tests about 5 years ago. So if speed is any concern to you at all then you might want to do this on a *nix machine instead of MS-Windows.

If all the columns are exactly the same width, with the same number of spaces or tabs between columns, then you might be able to treat the file as a binary file and use random access techniques on it. That way you could directly access any given row and column without having to read the whole file serially. This will not work though if some of the columns have varying widths.

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

nice comparisons, but it tests the speed of converting int to std::string, not the other way around. Interesting anyway especially for those who need to optimize their programs.

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

Mr Simple on YouTube. I couldn't understand a word they sang but they sang it very very well. Looking at some of the other YouTube music videos -- I didn't realize Chinese music became so westernized :-O Looks like China's version of America's (Britain's) Got Talent.

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

call getline() to extract the variables one at a time using the comma as deliminator. There are several ways to do it, here is just one of them.

Note that I did not compile or test the following code

#include <fstream>
#include <string>

using std::string;
using std::ifstream;

int main()
{
    string word;
    int num;
    ifstream in("filename.txt");
    while( getline(in,word,',') )
    {
       num = atoi(word.c_str());
       // now do whatever you want with this value
    }
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>> for int main() why do we always have to write return 0?
Its optional in c++ but not in C. The reason is because the c++ standards say its optional. If you don't specify a return value then return 0 is assumed.

MS-Windows and *nix operating systems do nothing with the return value except pass it along to a program that may have caused the program to be executed. return value of 0 is traditionally means the program executed everything successfully. Any other return value means nothing to the os, but traditionally means an error of some sort and the exact error is up to the calling program to determine.

Regardless of the return value the operating system will clean up everything when the program terminates.

>>also can someone explain when i use unsigned variables?? I never use them unless a function on MSDN requires it.. so is there any use of them other than passing them to functions as parameters

Yes -- I use them as loop counters and other occasions when negative numbers are not needed. I believe that gives the compiler to better optimize the code.

The reason for constants is to let the compiler know that the variable will never be changed, so that the compiler can optimize the code better. In some cases the compiler may be able to discard the const altogether.

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

use ReShaper6 if you have access to it. If you don't then checking in the folder locations as you mentioned and in their sub-folders is pretty trivial to code.

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

What version of VC++ are you using? I hope its not 1.52C :twisted:

MS-Windows sends out a WM_PAINT message when one of the events you mehtioned happens. Here are a few suggestions how to do it. Capture the WM_PAINT event or implement OnPaint() method, which one to use depends on how you write the program.

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

Any first year C programming student should be able to answer that question. If you could not then you are not yet ready to work as a professional programmer.

WaltP commented: That's for sure. +17
Jamblaster commented: Intelligent and 100% correct. I am new to programming and I know the difference between While and For so... +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

@detailer: what compiler are you using? If it doesn't recognize namespace then it may be Turbo C++?

The behavior of Ctrl+C is operating system dependent. With most MS-Windows compilers and console programs it causes the program to terminate immediately. On other operating systems Ctrl+C may do nothing at all. You can change that behavior but doing so may be above your current programming skills and knowledge.

You will be far better off taking either Narue's of WaltP's suggestions. Either will allow the program to continue executing after the loop terminates, while Ctrl+C will not.

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

A simple search and replace program would probably to the job. You could probably write your own in a couple hours or get a fancier one on the net (use google).

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

That question has been asked and answered several times -- see one of these threads

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

you can Check Jan Bodnar's tutorial

Nice tutorial, but its for *nix, not MS-Windows.

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

mysqlpp is created when you compile the MySQL++ library files (yes, you have to compile them yourself). If you are using VC++ 2010 Express then you will have to run the 32-bit version of mysql database server, not the 64-bit version because the c libraries are different. vc++ 2010 express can not link with 64-bit libraries.

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

Did you install mysql server? The libs are in that installation.

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

From the looks of those error messages it appears you failed to link with the mysql libraries. Look closely at the tutorials, such as this one, and it will show you how you need to link. That tutorial gives you the makefile you need if you use g++ compiler. For other compilers just link with the two libraries that are mentioned in the makefile (mysqlpp and mysqlclient)

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

mysql++ works with VC++ 2010. Must be something you are doing incorrectly. Post some code so that we can see what you are doing.

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

Here is one common example:

Write a program that sorts an array of 10,000 random integers using four different sort algorithms, then compare the results (time each one to find out which is fastest).

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

ip is just an int pointer because it has not been set to point to a particular object. int x = 1; int* ip = &x; is a pointer to a variable of type int. ip could also be a pointer to an array of ints

int nums[3] = {1,2,3};
int* ip = nums;
int* ip = &nums[0];  // This is another way of saying the above line
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

what error message(s) does your assembler give you?

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

extern means the variable may be declared in another source file or later in the same source file. See the remarks here

Also, the value of global variables are set before main() is called, which is why printf() can display the correct value of that variable.

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

change it like I showed you and it should work ok. Also check the file to see if there is anything at the beginning of the first line that would cause that behavior, such as a blank line.

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

>>i found this code on web but it has got code errors.
That often happens when you try to plagiarize other people's code.

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

fscanf() won't work for you if the line contains any spaces or tabs. Its better to just use fgets() to avoid that problem. And a better way to code the while statement is like this:

while( fgets(data, sizeof(data),separators_f) )
{
   char* ptr = strtok(data,",");
   i = 0;
   int line[5] = {0}; // this could be defined somewhere else
   while( ptr )
   {
       char* endptr = 0;
       line[i++] = strtod(ptr,&endptr);
       // at this point you might want to do some error checking
       // to make sure that strtod() worked ok.
       //
       ptr = strtok(NULL,",");
   }
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

what stick are you talking about? A USB device?

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

I tried a video tutorial once for another language but quickly found out that it was just too difficult to follow the tutorial and type the information into my IDE at the same time. I much prefer books where I can learn at my own pace.

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

Don't be like Chicken Little who thought the sky is falling. This isn't the end of the world even as we know it. Shit happens, outbreaks like that occur frequently all over the world and the world hasn't ended yet, neither has society.

Is society broken? No, it just has a minor crack that will heal.

susheelsundar commented: Experience and Wiseness Speaks. :) +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

AFAIK its in the boost distribution along with all of the other boost files.

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

By the way, it's math, not maths.

Depends on where you live. Here is another discussion about that.

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

One bright spot -- the price of regular unleaded gas went down 30 cents/gallon today, now at $3.39/gallon where I live. I heard on the radio that was the result of the stock market drop of over 600 points yesterday.