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

If they are numbers then don't put them in quotes

values(row1 & "," & row2...)

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

my guess is that the data types in the database table are not the same as the types in your sqlstring. Are all the column data types in the table strings?

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

You mean you created over 3,000 youtube videos???

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

You can change your program to ignore empty lines, just add the check just before line 17. If the line is empty don't increment the counter. But that may cause other undesireable side affects. Your program runs correctly as it is, if it doesn't display the lines you think it should then you need to edit the text file and remove the blank lines.

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

Check your text file -- your program ran ok for me. I have a text file that lists US state names and their abbreviations. Ran your program with "5 states.txt" and it printed the last 5 lines of that file. If the text file contains blank lines at the beginning or end of the file your program may not produce the desired results unless you expect the blank lines.

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

didn't you read the tutorial I provided???

To do it manually would I have to make a purchase?

No.

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

You need to get a resource editor.

If you want to create it manually, here is a popular tutorial.

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

yes

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

The pointer itself is passed by value, any changes you make to the pointer in reverse() is not visible to the pointer that was declared in main(). I ran your program and it looks like it works as expected.

If you want reverse() to change the pointer that's declared in main() then you have to pass it by address like this: reverse(&str) Then declare in in reverse like this: void reverse(char**str) But doing that will be disasterous because main() wouldn't be able to use the pointer any more and a memory leek will occur because main() can't delete[] it either.

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

what version of .net is the sbs 2003 running?

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

What version of MS-Windows did you wrikte the program on? Visual Studio 2012 uses .NET Framework 4.0 or newer, so you might have to install .NET 4 on that XP computer.

More info here. It will tell you what version of .NET your IE browser is using. You might visit that link from your XP computer too to find out what version of .NET it has installed.

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

I realized that stdio functions (and thus their fstream counterparts) use size_t to indicate the position in a file,

If you use win32 api function WriteFile() and ReadFile() then it uses 64-bit addresses which is two size_t integers.

You will find there is no such thing as unbound storage because the size of any one file is bound by the operating system parameters and hard drive size.

A file of files would require that I open and close each file every time I need it right?

Not necessarily -- you can have multiple files open at the same time.

The issue is that as far as I know, its when you close the file that you actually save it.

You can force the os to flush data to the file. stdio.h is fflush(stream) while fstream is stream.flush()

My second question then is: is there any way to NOT have to re-open those files every time I need them?

If you close the file then you will have to open it again. But why close it? Just leave it open for as long as the program needs to use it. As I said before you can have a lot of files open at the same time, the limit is pretty large.

My third question then is: is there any way to get the file name out of a FILE structure in stdio.

No. I've had that same question years ago. FILE …

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

you should call WaitForSingleObject() instead of Sleep(). Also you need to validate ShellExecute() did not return an error number.

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

By the time the program reaches line 15 the address of ptr_array has been changed to somewhere beyond the end of the array. If you want to print the first item in the array then you need to reset the pointer back to the beginning, like you did on line 5.

You can't print the entire array at one time like you are trying to do on line 15. Create a loop similar to line 7 and instead of cin on line 10 use cout.

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

Write a program that defines an array of integers

int a[5];

and a pointer to an integer

int *ptr;

Make the pointer point to the beginning of the array.

ptr = &a[0];

Now you should be able to finish the rest. Hint: to move the pointer to the next member of the array all you have to do is increment the pointer, much like you would increment an integer.

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

You might also check the documentation for the specific compiler you want to use, for example if you use Microsoft Visual Studio then read this article. I'm sure GCC has a similar page.

christinetom commented: Thanks for the help +1
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The reason for waiting until the array is filled before sorting is because your idea is just too slow. First you have to find the spot where to insert the new value, then move all data from that place to the end of the array. This is acceptable if there is only one or two values to be inserted, but not when you want to build an entire array from scratch.

Since you are new to c++ and programming I suggest you but your idea on the back burner for now and just concentrate on learning the language. You can always revive it at some future date after you have gained more experience.

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

post some code, I don't know what you are talking about. If it's in my code snippet it's more than likely calling _findnexti64() until that function returns no more file names. If you don't know what a function does then you need to google for it and you will find out what it does.

Since you want to use FindFirstFile() you will have to call FindNextFile() instead of )findnexti64() that is shown in my code. Both functions do about the same thing. Also notice on each call of _findnexti64() the program checks to see if the file is a folder name, and if it is the function recursively calls itself to process all the files in that folder.

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

You have to use a recursive function. I've written a code snippet that does exactly that for both MS-Windows and *nix. Or if you want to go a more portable way then use boost library.

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

try this (I don't know if it will work or not):

time > time.out | wc > wc.out

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

Conrol Manager --> Administrative Tasks --> Computer Management -->Disk Management. There you will see your hard drive(s) and partitions. Dis you install Windows 8 in a separate partition? That would make it a lot easier to remove it.

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

According to Sams, it will only take 24 hours, see Sams Teach Yourself Java in 24 Hours.

ddanbe commented: Good thinking! +14
iamthwee commented: lol +14
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I love this tutorial, shows you lots of things about vb.net, including the solution to this thread. I wound up buying the ebook because it contains a couple more chapters that are not in the free online tutorial.

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

call Directory.GetFiles() as shown here. But be warned that this will take a long time to search your entire hard drive for the files you want. It would be a lot faster to use an MS Access or other SQL database to keep the links to the files.

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

No, you didn't ruin my day :) Just mark the thread Solved and everything will be ok.

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

Sounds like you created a windows console program but attempting to compile a Windows win32 api GUI program. win32 api programs have WinMain() instead of main() as in console programs.

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

lines 26-28: you can't put functions that have no return value in cout statements. What do you expect cout to print? It can't print what the function doesn't return.

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

but still and still, i am very very optimistic guy.

Think of it as you would when you use a paper shredder to destroy documents. Once shredded there is no way to replace the document (assuming there are no other duplicate copies). You are just SOL.

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

Each compiler has it's own implementation of malloc(), but the ones I've debugged (stepped through the assembly code to find out how it does it) initially has a large block of contiguous memory. malloc() it tries to find a free block that is as close as possible to the amount of memory you requested plus some memory for it's own use such as pointer to the next free block of memory and the size of this memory block. So if you request 8 bytes and the smallest available free block is 16 bytes then malloc() might return a pointer to that 16-byte block of memory. When you call free() the compiler puts a pointer to that block back into the free-memory pool so that it can be given out by malloc() again. Some compilers may try to optimize the free memory pool by combining adjacent blocks of memory, defragment the memory, but tha is not always possible.

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

malloc() returns a block of memory AT LEAST as large as you requested, which means it could be larger.

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

It might depend on the compiler. What compiler and operating system are you using? On 32-bit VS 2012 it produces 12. The difference might be your definition of tick.

#include <stdio.h>

typedef int tick;

typedef struct dataPoint {
    tick * tickData;
    struct dataPoint * previousDataPoint;
    struct dataPoint * nextDataPoint;
} dataPoint;


int main()
{
    printf("sizeof(struct) = %u\n", sizeof(struct dataPoint));
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I saw this one coming as soon as Dani gave members the ability to delete their account.

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

I don't have your compiler but it compiles ok with Visual Studio 2012 after fixing the two static variable problems I mentioned.

#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include <ctime>
using namespace std;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//global constants & vars.
const char EMPTY=' ';
const char x='X';
const char o='O';
const char& X=x;
const char& O=o;
char empty=' ';
char& eRef=empty;

//GetOpposite function-needed in Computer obj.'s GetMove() member function & when assigning each obj. their own m_pieces'
int GetOpposite(const char& aPiece)
{
    if (aPiece==X)
    {
        return O;
    }

    else
    {
        return X;
    }
}


//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
class Board
{
    friend ostream& operator<< (ostream& os, const Board& aBoard);

public:
    Board();
    bool GameWon(char& charRef);//
    bool GameTied();//
    bool IsFull();//
    int  GetHumanMove(); //Gives column #
    void SetBoard(int& column,const char& character);
    bool MoveAcceptable(int& rAns);//
    void RemoveTopPiece(int& colNum);//
    void ClearBoard();//
    bool GameOver(char& r_PieceThatWon);

private:
    int ConvertX(int* pX);
    int ConvertY(int* pY);
    bool ColumnCheckFull(int& column);//
    char m_Array[7][6];
    int m_Rows;
    int m_Col;
    int m_winComNum;
static    int m_Combinations[57][4];

};



int Board::m_Combinations[57][4]={
        {1,8,15,22},{8,15,22,29},{15,22,29,36},
        {2,9,16,23},{9,16,23,30},{16,23,30,37},
        {3,10,17,24},{10,17,24,31},{17,24,31,38},
        {4,11,18,25},{11,18,25,32},{18,25,32,39},
        {5,12,19,26},{12,19,26,33},{19,26,33,40},
        {6,13,20,27},{13,20,27,34},{20,27,34,41},
        {7,14,21,28},{14,21,28,35},{21,28,35,42}, //finished with vertical combinations (21)

        {1,2,3,4},{2,3,4,5},{3,4,5,6},{4,5,6,7},
        {8,9,10,11},{9,10,11,12},{10,11,12,13},{11,12,13,14},
        {15,16,17,18},{16,17,18,19},{17,18,19,20},{18,19,20,21},
        {22,23,24,25},{23,24,25,26},{24,25,26,27},{25,26,27,28},
        {29,30,31,32},{30,31,32,33},{31,32,33,34},{32,33,34,35},
        {36,37,38,39},{37,38,39,40},{38,39,40,41},{39,40,41,42}, //finished with horizontal combinations(24)

        {4,10,16,22},{5,11,17,23},{11,17,23,29},{6,12,18,24},{12,18,24,30},{18,24,30,36},
        {7,13,19,25},{13,19,25,31},{19,25,31,37},{14,20,26,32},{20,26,32,38},{21,27,33,39}}; //finished with diagonal combinations (12)



bool Board::GameOver(char& r_PieceThatWon)
{
    //check for tie
    if (GameTied())
    {
        return true;
    }

    else if (GameWon(r_PieceThatWon))
    {
        return true;
    }

    else
    {
        return false;
    }
}
Board::Board()
{
    m_Rows=6;
    m_Col=7;
    m_winComNum=57;

    for (int i=0; i<7;++i)
    {
        for (int v=0;v<6;++v)
        {
            m_Array[i][v]=EMPTY;
        }
    }
}


bool Board::GameWon(char& charRef)
{
    //Checks if the game has been won
    //Check possible combinations
    //character reference …
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

lines 54-56 -- class member variables can not be initialized like that -- put the initialization inside the constructor.

The same with line 57 -- can't initialize non-static arrays like that either.

Also: static class data objects must also be declared as if they were normal global variables, that is, outside any function or method, something like this If you make the array that is on line 57 static then it can be initialized globally as illustrated in my code below for someVariable. All you have to do is copy all that initialization code into global area of your program, most likely before the class's implemsnetation code.

class MyClass
{
private:
    static int someVariable;
};

int MyClass::someVariable = 0;

int main()
{

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

If the problem is solved then please mark it solved. There is a button for it near the bottom after the last post.

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

Yes, you need to move one line

int main()
{
        char anotherSale = 'x';
    do  // Loop for repeat sales
    {
        double cashDrawer = 500.00;
        int productID = 0;
        int quantity = 0;
        double cashTendered = 0.0;
        double fCash;
        double mReceived = 0.0;
        double price = 0.0;
        double subtotal = 0.0;
        double salesTax = 0.075;
        double total = 0.0;
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

maybe you didn't do it right

#include <iostream>
#include <iomanip>
using namespace std;

int main()
{
    do  // Loop for repeat sales
    {
        double cashDrawer = 500.00;
        int productID = 0;
        int quantity = 0;
        double cashTendered = 0.0;
        double fCash;
        double mReceived = 0.0;
        double price = 0.0;
        double subtotal = 0.0;
        double salesTax = 0.075;
        double total = 0.0;
        char anotherSale = 'x';




        do
        {
            cout << "Please enter desired Product ID or -1 to exit: ";                 // Enter the first Product ID for the first sale (-1 to exit)
                                                                                              // Main loop for each sale
            cin >> productID;



            if (productID == -1)
                break;

            cout << "Please enter desired quantity: ";
            cin >> quantity;


            switch (productID)
            {
                case 101:

                    price = 65.00;

                    subtotal = ((price * salesTax) + price) * quantity;

                    break;

                case 102:

                    price = 12.50;

                    subtotal = price * quantity;

                    break;

                case 103:

                    price = 24.50;

                    subtotal = price * quantity;

                    break;

                case 104:

                    price = 38.75;

                    subtotal = ((price * salesTax) + price) * quantity;

                    break;

                case 105:

                    price = 17.80;

                    subtotal = ((price * salesTax) + price) * quantity;               // Switch statement to determine the price, and calculate sales tax, if any, for the item.

                    break;

                case 106:

                    price = 16.50;

                    subtotal = price * quantity;

                    break;


                case 107:

                    price = 42.85;

                    subtotal = ((price * salesTax) + price) * quantity;

                    break;

                case 108:

                    price = 32.99;

                    subtotal = ((price * salesTax) + price) * quantity;

                    break;

                case 109:

                    price = 28.75;

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

Move lines 20 and 21 (beginning of the first do loop) up to just after line 6 so that all those variables are declared inside the first do loop. That way they will get reset to 0 each time the first do loop is executed.

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

post the assembly code that's in your program, e.g.

    asm {
        mov ax,1
        mov bx,ax
    }
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I have no idea -- have not used Turbo C in 30 years.

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

fflush is not supposed to work with stdin -- it's only for output streams like stdout. You can write your own fflush like this

void flushKeyboard()
{
   while( kbhit() )
       getch();
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Before calling getch() find out if anything is in the keyboard buffer kbhit() from conio.h will tell you that. If nothing there then you can check for mouse input.

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

line 44: remove the semicolon. As it is, it's just a function prototype.

line 46: ignore() removes one or more keys from the keyboard buffer.

When you come across a function that you don't know what it does you need to use google to find out about it.

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

min and max do not work with floats -- use only integers with those macros. For floats you have to use fmin() and fmax()

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

However, the more veteran members (many of which no longer participate) were able to rack up quite a bit of reputation points over the years in these categories.

DaniWeb has not allowed rep in Community Center for several years now. I don't know how many I got from there but you would probably be surprised to see how few of mine are from my posts in Community Center. Most (roughly 80%) of my 32,000 posts are in the C and C++ forums over the past 7 years. So even if Dani removed all those rep points as you suggest it probably would not make much difference in member's rankings.

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

The functions are commented out. For example, look at line 17 in words.c

#if ylop == 'B'

Where is ylop defined?

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

Your example is incomplete/incorrec -- where is the variable i changed? Answer: it isn't, so the output you posted is wrong. The correct output is "111111111..."

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

please zip up your project source files and attach them to your post along with the makefile you use. We don't want the compiler-generated files such as *.o so delete them before zipping.

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

The while statement is a loop that contininues to execute until some condition is met. For example consider vriable named x in this simple example

int x = 0;
while (x < 10)
{
    x++;
}

In the above the loop will continue until the value of x reaches the value of 10. Notice that the value of x is incremented inside the loop. If x was not incremented inside the loop, the loop would be considered an infinite loop because the value of x would never change. So there must be something inside the loop that will eventually make it stop.

Another way to make the loop stop is to use the break statement

int x = 0;
while( x < 10)
{
   if( x > 2)
      break;
   x++;
 }

I know that is kind of a stupid program but it illustrates how to stop the loop early.

That really all there is to a while loop -- nothing more difficult then that.

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.