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

I don't have that problem but things are really looking screwy.

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

Oh! Sorry, my mistake. It should have been 'begin()'

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

You will have to post the code you changed. You obviously misspelled something because there is no such function as 'gegin'. Did you mean getline() ?

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

I thought you said that LoadTextFileToEdit() function worked? Well, the function you posted can't work the way you think it does -- see my previous post about how to correct it.

And you might want to review this example program.

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

You mean this loop?

for(int i = 0;i < nTimes; i++)
							{
								string* word = spnV[i];

What is the value of nTimes? Why are you using a string pointer? spnV is an array of strings, not pointers.

I think that should be like this: I like to use iterators because I have had a few problems with just using size(), especially if some of the strings have been deleted from the vector. Note: assume hwnd is a handle to the listbox control.

vector<string>::iterator it = spnV.gegin();
for(; it != spnV.end(); it++)
{
   SendMessage(hwnd, LB_ADDSTRING, 0, (*it).c_str());
}

}

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

They why are you wasting our time with that crap?

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

I didn't make the function; I'm just supposed to use it.

Whoever made that function is out of their mind -- it doesn't work as written because it doesn't load the strings into the vector.

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

OMG what in the world are all those getline() calls???? If you want to put all those strings into the vector then use a loop! Use a string object to read the string and delete that damned character array (sztemp) which just takes up useless stack space. Replace lines 19 thru 75 with this simple loop.

string line;
while( getline(inStream, line) )
{
    spnV.push_back(line);
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

It doesn't matter. If the functions follow main() then you have to declare the function prototypes before they are called. In really small programs I like to put main() at the bottom so that I don't have to mess with creating the prototypes.

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

what are the advantages and dis advatages between windows and console files?

A Windows project allows you to write GUI program (tutorial), such as one which you see when you run Notepad.exe. cout does not work with Windows programs, and requires WinMain() instead of main().

A console program has int main() and when run it normally opens up a console window. I think allegro programs require console programs.

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

What functions are you using to do the copying? win32 api CopyFileEx() will call your function for each portion of the file that has been copied, allowing it to update the progress bar.

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

>>[Linker error] undefined reference to `WinMain@16'

You created the wrong kind of project -- create a new console project then copy/paste that program into it.

>>should I put that on line 25 of my code or right after mian ends?
Exactly as shown. Read the allegro tutorials here

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

You'll have to post the code as I'm sure there is another problem.

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

>>These headers will "load" other headers..? Is this illegal?
Yes. Many standard system header files include other header files.

>>in this case its not bad, but if im using some audio processing function, it could name-clash with a similar function for midi.)
There will be no name clashes because that's exactly one of the purposes of namespaces. Everything in <iostream> is in std namespace.

>>Any Idea how i can call jack_create_client() in a similar way to Engine::Audio::jack_create_client() without this problem??

What problem? If jack_create_client() is in global namespace then just call ::jack_create_client() and that will be different then the function with the same name but in namespace Autio.

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

This works. But frankly I don't like using those win32 api file i/o functions because standard c++ std::fstream is a lot easier to work with.

#include <windows.h>
using namespace std;

int main()
{
    HANDLE hFile = CreateFile("TextFile1.txt", GENERIC_READ|GENERIC_WRITE,
            0,0,OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);

    if( hFile != INVALID_HANDLE_VALUE)
    {
        char text[] = "This line was added\r\n";
        DWORD dwBytesWritten = 0;
        SetFilePointer(hFile, 0, 0, FILE_END);
        WriteFile(hFile,text, strlen(text), &dwBytesWritten, 0);
        CloseHandle(hFile);

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

Write a comparison function that compared the substrings of each string.

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <ctype.h>
using namespace std;

string getsubstr(const string& s)
{
    size_t pos = s.find('-');
    string v1 = s.substr(pos+1);
    // now remove any leading white space characters
    while( isspace(v1[0]) )
    {
        v1 = v1.substr(1);
    }
    return v1;
}
struct myclass {

    bool operator()(const string& s1, const string& s2)
    {
        string v1 = getsubstr(s1);
        string v2 = getsubstr(s2);
        return v1 < v2;
    }
} myobject;


int main()
{
    vector<string> towns;
    towns.push_back("Joshua Lynn Odom -  Bates Town");
    towns.push_back("Cindy Blue - Broken Arrow");
    towns.push_back("Donnie Kay - Oklahoma City");
    towns.push_back("Billy Bob - Durant");
    towns.push_back("Randall John - Lawton");
    towns.push_back("Danny Steven Ray - George Town");
    towns.push_back("Rodney White - Lone Grove");
    towns.push_back("Tammy Smiley - Ada");
    std::sort(towns.begin(), towns.end(), myobject);

    vector<string>::iterator it = towns.begin();

    for( ; it != towns.end(); it++)
        cout << *it << "\n";
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
#include <iostream>
#include <string>

using namespace std;
int main()
{
    string str = "Hello*World";
    str.replace(5,1,"%2A");
    cout << str << "\n";
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Thank you everyone for your kind remarks. I assure you that I won't disappear forever, I just won't be as visible as I have been in the past. At least for the present.

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

windows 7 is still in beta, it will probably work ok when released this October. I just created a standard console project.

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

Just want to announce that I am resigning as moderator due to health reasons. It was a pleasure to have had the opportunity to work with all of you DaniWeb members, the moderator team and administrators. I will continue to drop by now and then to see how things are going, but will not be as visible as I have been in the past.

As Mr. Spock would have said, Live long and prosper.

Melvin

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

merged the two threads

ddanbe commented: Thanks. +7
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>That being said, you blame the deficit on Obama... whose fault was it for letting it start? Oh! The Republicans!
Actually it was the Democrats who started it off in 1965 LBJ (Lyndon Baines Johnson) and his Great Society projects and War On Poverty. Then a few years later the Democrats wanted everyone in America to share in the "American Dream" and required lending institutions to let people buy big expensive homes even though they couldn't afford the house payments. And of course we can't leave out the Republicans, such as Ronald Reagan for starting the Deregulation craze.

>>This president is leading us
Oh, so now you admit Obama is a leader :)

>> in an unprecedented deficit
Although that statement is true, it started with GW Bush. He signed a $1Trillion bailout bill, and no one knows what happened to that money -- no accountability.

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

Install the Redistributables and your program should be ok. Also read this article carefully.

Creator07 commented: I can't stop reputing you... +1
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Here are a few tables that will show the ascii codes for all possible values. Note that decimal values 0 thru 32 are not printable so you won't see anything on your screen for them. Only values 33 thru 126 can be shown on the screen.

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

Try this. GetNext() simply returns NULL and that is not what you want.

void Lobby::AddPlayer()
{
    //create a new player node
    cout << "Please enter the name of the new player: ";
    string name;
    cin >> name;
    Player* pNewPlayer = new Player(name);

    //if list is empty, make head of list this new player
    if (m_pHead == 0)
    {
        m_pHead = pNewPlayer;
        m_pTail = m_pHead; //m_pHead->GetNext();
    }
    //otherwise find the end of the list and add the player there
    else
    {
        m_pTail->SetNext(pNewPlayer);
         m_pTail = pNewPlayer;
         //m_pTail = m_pTail->GetNext();                   
                                        
    }
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The trick in this article certainly does make the file or folder hidden from normal view, but not unusable. The only way I could find to access the folder is via command prompt window. In practice, I suppose you would have to remove the system file attribute, do whatever you want to do with the folder, then apply it again when done.

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

i used to use the recycler to hide files, then one day all the files disappeared, i swapped the hard drive to a new computer and that computer deleted the folder

I'd say that wasn't the brightest place to hid files :) :)

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

>>was hoping u or some one wood direct me to a specific scource.... since were in C++ forum

There is no specific source. Modular programming is a concept, not something you can show and say "well that's it.". If you really googled like previously suggested then the very first link gives a good explanation from a Wikipedia article.

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

Like you would know whatever he's doing in a given day.
You never cease to surprise me in how gullible you are. This president is leading us in an unprecedented deficit and you still believe it is in him to get us off of it. Amazing!
He is using the circumstance to achieve his agendas.

I never said I actually agreed with what he is doing. That was not the point. The point is --- "damned if he does and damned if it doesn't". Abraham Lincoln once said that you can please some of the people all of the time and all of the people some of the time, but you can't please all of the people all of the time. As I said before, you would probbly bitch regardless of what he does.

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

If all you want to do is download a file then this is the function for you. Also see this thread.

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

Second problem: look up in your textbook about Pure Virtual classes and functions.

Third problem:
1. pulblic: -- mispelled
2. Shape needs a default constructor (one with no parameters)

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

Presidents have to be leaders -- what would you think if President Obama stayed in the Oval Office and did nothing all day unless the will of the people or the Constitution demanded it? I'll tell you what would happen -- he would be considered a do-nothing President who is unfit for that office. I don't want a President who does only the minimum required to do his/her job. I want him to take a lot of initiative and lead us, for example, out of this financial mess were are now in.

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

This code is not sufficient and won't work on some Windows SPx.....

This worked for me on Vista Home using VC++ 2008 Express. But yes, anyone wanting to use that function needs to know what they are doing, such as reading all about it on MSDN and possibly other places.

#include <windows.h>

int _tmain(int argc, _TCHAR* argv[])
{
URLDownloadToFile(NULL, _T("http://www.daniweb.com/certificates/posts46588.jpg"),
     _T("c:\\dvlp\\posts46588.jpg"), NULL, NULL);
	return 0;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

after the cin line call either toupper() or tolower() then make the test.

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

I don't know what you mean by "helping yourself" and "security part" of DaniWeb. I don't think we have anything like that.

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

Observation: string.h is a standard C header file -- rename yours to something else to avoid filename clashes. In MS-Windows file names are not case sensitive like they are in *nix, so String.h is the same file as string.h, which is clearly not what you want because your program is using some of the functions in the standard string.h header file.

Also I would rename that String class to something else to avoid confusion with the string class in STL library.

String::String(const String &s)
{
	this->setString(s);
	cout << "End Copy Constructor..." << endl;
}

One problem is with the above code. You forgot to set this->stirng = NULL; before calling setString().

String& operator = (const String &);
		String& operator += (const String &);
		String& operator += (const char *);

Make the above three functions return a reference to the String, not a new copy of the String. Then at the end of each of those functions just add return *this; Your class test program worked without fail after making the above changes.

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

Delete all compiler-generated files, zip up the remainder and attach it to this thread so that we can see exactly what you are trying to do.

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

1) In *.cpp file do NOT use that pragma -- its only intended for include files

2) I just created a CLR Windows Forms application and had no problem including those files using VC++ 2008 Express. I also added them to the .h file with no problems.

#include "stdafx.h"
#include<vector>
#include<string>
using namespace std;
#include "Form1.h"

using namespace winform;
// 
// rest of *.cpp code here
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

No, I think he's asking how a business can profit by providing open-source software. I know that Red Hat Linex maked their money on technical support and customizations. Similar with MySQL.

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

I'm not a thrill-seeker, never have been. Even a faris wheel scares me when it stops me at the top.

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

The only reason I buy it is so that I can have it where I work. Otherwise at home my refrigerator has a cold water filtered facet that is quite cheep to operate. The bottled water that I buy costs about $0.12/20-oz bottle, or about $0.75/gallon. If you are paying much more than that I'd suggest you start buying a different brand of bottled water.

The best tap water I ever tasted in my life was around the Great Lakes in New York State (not far from American/Canadian border). I went there on a business trip once, stopped at a restaurant and couldn't stop myself drinking lots of water. I have not tasted anything like it since then either.

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

I suggested that same thing a few months or a year ago but was boldly ignored. Dani is not amiable to creating new forums for whatever reason.

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

I have never received that PM before either. And I ignored it because most of the questions do not apply to me and there were no appropriate answers for someone like me. I started to fill it out, but quit when I got to the part that asked for personal information.

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

I'm trying to write a GUI program where I want to use both strings and vectors, but the computer won't recognize them no matter where I try to include <string> and <vector>. Can you tell me where in the code I need to put my includes and my std namespace?

Please post the code you tried, and a few of the error messages. Placement of the headers should be no different than non-gui programs.

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

Use either ODBC or ADO in c++ programs. Neither are for the faint of heart and require a firm grasp of c or c++ fundamentals. Microsoft's MFC class also has a database class.

Once you have the query, I'd put the query contents in a vector< vector<string>> object, assuming all the columns are strings. If the columns are a mixture of datatypes, which is a common thing, then you might want to create a union structure and put them in a vector of those structures.

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

Welcome to DaniWeb. Just how "elderly" are you anyway? If you are over 100 you might have problems learning to program :)

Where to learn depends on the programming language. But we can discuss that more in DaniWeb IT Professionals' Lounge.

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

The first parameter needs to be a reference or pointer to a pointer. All that function is doing now is changing its own local copy of the pointer.

Suggest either of these changes: void double_array_1d(int** arr, int length) or this void double_array_1d(int*& arr, int length) If you use the first form you will have to make a couple minor other changes *arr = temp; and temp_arr[i] = (*arr)[i];

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

>>what do I change to see a different name at the top?
Are you concerned with the version of the compiler (e.g. VC++ 2005 or VC++ 2008) or the version of the program?

-is duplicating folders the best method for making new versions?
IMO -- yes. The released version of those programs should be archived off somewhere, such as on disk or in a CVS type verson control program.

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

Welcome to DaniWeb. There is lots of posts here for you to help. And yes, we don't do people's homework for them either.

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

I've found that some compilers don't care whether you put in quotes or angle brackets. I personally like using the quotes to make it easier to distinguish compiler standard headers from others.