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

When you have a lot of paraemters like you originally posted it is probably better to use a structure because it's easier to read and understand. With individual parameters it can get a little messy later in the program trying to figure out where a variable is declared. With a structure there is never any doubt. It's also less likely that a global variable will be hidden by a local parameter variable with the same name, and that can cause countless debugging hours trying to figure out why the global variable isn't getting changed when you think it should (been there and done that).

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

Just be aware that you should not use malloc(), realloc() or free() in c++ programs because they do not call c++ class constructors or destructors. Instead, use new and delete. Unfortunately there is no c++ equivalent of realloc().

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

Yahoo! Looks like that worked, has not erased the home page url since I manually set tha registry entry. Thanks for the suggestion.

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

I just tried attaching a pdf and did not have any problems. But then it might be my location (USA)

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

Can't you use pdf reader to copy to the clipboard then paste it into your post?

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

Read this

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

that turbo c++ program is using deprecated header files -- you will have to change the code to use current c++ standards, such as <iostream> instead of <iostream.h> There will most likely be other code changes you will have to make, such as std::cin or using std::cin statements.

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

Call time() from time.h to get time of registration. I assume time of registration is when SetPatientInfo() is called. As for treatment time -- you will most likely have to get it as a string from user input at the keyboard.

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

You forgot to attach it. Just paste it into your post so that people won't have to look for it somewhere else.

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

If you don't like Windows 7 then I can't wait to hear what you think of Windows 8 :)

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

I don't know if they are correct or not, I never used those functions. You'll just have to test them yourself -- and read about them in online docs -- to see if your program is correct or not.

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

SelectString() does not search for whole strings, only for the number of characters that are in the second parameter. So if you pass "-1" then it will consider "-12" as a match because it only looks at the first two characters. To solve you problem you should call SelctString() again with the first paremter set to the value returned by the first call to SeleectString().

Another way to solve the problem, which might be even better solution, is to capture the WM_COMPAREITEM event so that you can control how the strings are compared. See the Remarks section here In order to do that you will have to subclass the CComboBox control (see tutorial here)

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

Is that a laptop or PC? (I don't know the solution to your problem)

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

I had my son build me a game computer about a year ago when Diablo III was released, it cost about twice what you posted. One of the components was a Gigabyte motherboard, it lasted about 6 months before components started going out. Eventually I replaced it with a Asus motherboard.

Where did you get the prices for those components? Newegg seems to be reasonable

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

what does "GET / HTTP/1.0" mean?

That is not related to sockets. To understand what that means requiires knowledge about how servers and clients pass data back and forth. Suggest you read tutorials about HTML etc from www.w3schools.com, for example this page explains get and post commands.

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

After googling for asprintf() I see that function is a GNU-extension to the C language, meaning that it not supported by any other compiler in the whole wide world. Other than that problem the function does allocate the memory needed, so my previous comment is not valid.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
  char *hex2Value="";        
    while(*p) {
  //printf("\n\nstr: %s\n", p);
  asprintf(&hexValue,"%s%02x",hex2Value,p);

And just how do you expect the above to work? hex2Values is just a pointer that points to a single byte of read-only memory. I don't know what asprintf() does (it must be a non-standard function) but it certainly can't successfully write anything to tha pointer.

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

Dawn of the computer age is mostly responsible for obese children, all they want to do is sit playing on a computer or texting. Even their brains are getting fat due to lack of use, such as learning to do math in their head instead of on a calculator. Some day in the future man will evolve without brains due to lack of use.

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

I use this socket library witten by someone else. It's pretty simple to use.

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

I just finished posting a program on a web site found here that does just that for a different web site. The only thing you could probably use from my program is how to use sockets to access the api from DaniWeb. I have not gone tough DaniWeb's api yet to find out how it works.

It would be nice if we could edit the snippet code and/or description at some later date.

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

First make an int array that has 12 rows (jersies 0-11) and 5 columns (5 bases). See this article how to declare tw-dimensional arrays. Then you need to create two loops, one inside the other. The outer loop is for each of the 12 jersies, while the inner loop allows someone to enter the data for esch of the bases.

Take the problem in small steps, don't attempt to write it all at one time. Write some code, compile, fix errors, then write some more code. Repeat those steps until the program is finished.

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

Do you mean this?

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

why don't you just upgrade to Visual Studio 2012? The express version is free.

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

I can't get IE10 on Windows 8 keep the address of my desired Home page. I want to use google.com as the home page, I go to Internet Options, Use Current Page as home page, then save. It works for only a few minutes before reverting back to blank address. I always run AVG antivirus, and occasionally run malware checker, but nothing will fix this problem.

Anyone else have similar problem?

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

In order to get a client id so that we can access the api the registration process requires a web address. If the program is going to be PC based there is no web address. Can we register without a web address?

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

Maybe here at DaniWeb in Geek's Lounge or in Website Reviews.

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

Both your solutions are not as good as using the os api. Both your functions are CPU hogs.

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

Contrary to what you might think the Patriot Act did not replace the 4th amendment -- the 4th amendment is still alive and well. What it did was give the government broader powers to search and seize.

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

Here's an article about why we don't let just anyone bring anything across our borders. We've had too many problems with people knowingly or unknowingly bringing diseased agriculture products here. And some states do not allow fruits to be brought across state borders. I recall 40 years or so ago my mom and dad took a trip to Arizona and a border guard took her orange she was eating!

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

what compiler did you use? And what operating system?

The function want_secs() is completely unnecessary. If you want your program to wait for awhile then use os-specific api to do that so that other processes can get CPU time instead of your program hogging it all up.

MS-Windows: win32 api function named Sleep() (except old Turbo C, which has a wait() function of its own).

*nix: sleep() or wsleep()

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

The loops have already been posted two or three times in this thread. You yourself posted the loops just a couple hours ago. You don't have to include anything else -- just get the loops correct.

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

So in my output file, I would like the data to look just like dropsOf[][] with 4 rows and 5 columns

Yes, you need two loops for that, one for the rows and the other for the column s

for(int count = 0; count <= numRows; count++)

Wrong. count goes up to, but not including, NumRows. Count them on your fingures if you have to -- 0, 1, 2, 3 and 4. That makes 5 columns. There is no such column number as NUM_COMPONENTS (which is 5 in your program). You have the same problem with the inner loop.

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

Maybe -- but you can't count on it.

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

In America there is the Bill of Rights, or something like that, which makes it very unlikely that a personal computer could be investigated without good reason.

It's the fourth amendment to the us constitution

The right of the people to be secure in their persons,
houses, papers, and effects, against unreasonable searches and
seizures, shall not be violated, and no Warrants shall issue, but
upon probable cause, supported by Oath or affirmation, and
particularly describing the place to be searched, and the persons or things to be seized.

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

It would be helpful to name the variables something meaningful, especially if you want to post the code on a forum such as this one. No one has a clue what values[][], totals, NUM_COMPONENTS, etc are supposed to represent. Whether two loops are necessary depends on what you want to write to the file. Certainly values[x][NUM_COMPONENTS] is incorrect because NUM_COMPONENTS probably exceeds the array bounds. I said "probably" because I don't know how you declared values variable. So without more information it's almost impossible for anyone to determine what should be written to the file.

As for the calculations, notice that the value of numRows never changes within the loop, so why calculate numRows * NUM_COMPONENTS on every loop iteration? Make the calculation only once before the loop and use that in the loop.

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

Re-read my previous post

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

ofstream must be passed by reference, not by value as you have done. Not: don't use a calculated value in the loop condition because it is calculated on every loop iteration. Make the calcuation before the loop starts then use it in the loop condition, as shown below.

void storeProportions(ofstream& output, int values[][NUM_COMPONENTS], int totals, int numRows)
{
    double finalOutput = 0;
    int maxnum = numRows * NUM_COMPONENTS);
    for(int count = 0; count <= maxnum; count++)
    {
        output << values[count][NUM_COMPONENTS] / totals) << endl;
    }
}

The above code still is incorrect because there is no such element as values[cound][NUM_COMPONENTS]. Are you attempting to write all the array values to a file? If yes then you will need two loops

    void storeProportions(ofstream& output, int values[][NUM_COMPONENTS], int totals, int numRows)
    {
        double finalOutput = 0;
        for(int count = 0; count < numRows; count++)
        {
            for(int j = 0; j < NUM_COMPONENTS; j++)
            output << values[count][j] / totals) << "\t";
        }
        output << "\n"; // new line
    }
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

If all you want is the first column from each line why are you using a loop to iterate through all the columns of the row? Just call getline once, process the token, then read the next row, ignoring all other columns in the row just read.

I don't see where you declared data_vector, is it an array or is it a std::vector? In all the code I posted below I'm assuming it is an array that is large enough to hold all the numbers. If however it is a std::vector then you will want to use push_back() to insert new values into the vector.

while(getline(ratesfile, line))
{
    iss << line;
    getline(iss, token, ','); // get first column
    data_vector[row++]=atof(token.c_str());
}

That can also be done without using stringstream object

    while(getline(ratesfile, line))
    {
        size_t pos = line.find(',');
        data_vector[row++]=atof(line.substr(0,pos).c_str());
    }

Because atof() stops converting when it encounters the first non-numeric character the loop can be further simplified like this:

        while(getline(ratesfile, line))
        {
            data_vector[row++]=atof(line.c_str());
        }
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The second parameter is incorrect -- do not specify the dimensions

storeProportions(output, dropsOf, totals, numFailed); //located in main

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

I think I have also heard "to snap something" as meaning "to steal something".

That's "to snatch" not "to snap"

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

you can only get the source code from whoever write the dll in the first place. There is no way to derive source code from the dll file itself. The best you can do is get the assembly code using a disassembler.

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

what do you mean by that? vb6 programs are not web applications -- they only run on a local computer wjuch as the one you use at home or work. I don't know if vb.net can be used with a web server or not, my guess is not. There are several other programming languages that are better suited for that.

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

and originated from verb "to snap"?

"to snap" means to break in half, such as snap a twig (small tree limb). It could also mean to rub the thumb and middle finger together to make a noise -- snap you fingers. People who do those things are not usually called snappers.

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

Replace with NULL to indicate it has no value, assuming the field is allowed to have NULL values.

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

you can even try getch() instead of _getch()

Depends on which compiler you use. Microsoft compilers use _getch() while others might use getch() without the underscore. This is just one reason why conio.h is considered non-standard because its contents are not consistent from one compiler to the next.

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

void AddRecord(ifstream&, struct record[20], int& length)

The first parameter is missing a variable name, e.g. ifstream& infile. But it doesn't make any sense to have an ifstream parameter to that function because AddRecord() creates a new record, not reading from a file.

Inside AddRecord() I assume you will want a loop to create up to 20 new books, so you would start out with a for loop that counts from 0 to 20. Inside the loop prompt for a book structure member's data and get keyboard input for it. If your instructions say the function is to add only one record then you don't need a loop -- use ther length paremter to determine which record to add, then increment length.

SaveBook() -- the first paremter is wrong -- you can't write to an ifstream object, you need ofstream for that. It's best not to pass it as a parameter, but create the ofstream inside the SaveBook() function. Is that function supposed to save all 20 books at the same time or only one book? That will make a difference how you write the function.

The two functions should be prototyped like below: Note that neither function uses an ifstream parameter. Also note that SaveBook() does not need a reference to numRecords because it won't make any changes to it.

void AddRecord(struct record[20], int& numRecords);
void SaveBook(struct record[20], int numRecords);
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

public transport > dying of air pollution

Maybe in your country, but not everywhere on Earth.

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

Here is the list I see. Go to c++ forum then hit the Endorse button.

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

christina>you doesn't show up in the list of people that can be endorsed in the c++ forum. AFAIK you have to hit the Endorse button in the dark-purple ribbon at the top of the page and you will get a list of members who you can endorse. christina>you is not in that list, at least not in the one I see.

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

if you make even one post in a forum, that shouldn't preclude allowing people to endorse you

Oh but I think it should. Why should I get an endorsement in Java if I make just one comment -- right or wrong? That wouldn't happen if eligibility were based on the number of upvotes or some other criteria.