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

Microsoft Visual C++ 2008 (Professional and Express Edition) both allow you to compile your code as a native Windows executable, so the application compiled as a native Windows executable will be able to run without .NET Framework.

From Wikipedia:

( Source: http://en.wikipedia.org/wiki/Microsoft_Visual_Studio_Express )

That's correct -- but I don't think you can get a version of Windows that doesn't include the .NET Framework. Its like asking for a version of Windows without IE -- it won't happen.

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

what api would you all recommend to learn? i dont really want to use visual c++ .net since i want it to be independent from the .net library.

There is only one win32 api and has nothing to do with .NET. All win32 api functions can be called from any programming language, such as C, C++ and VB and just about any other programming language you can think of.

If you want a c++ version, then wxWindows might be a better choice for you. wxWindows is also portable to other platforms, such as *nix.

is there an api that is easily bundled with the exe such as when you install many windows programs it just works with out any additional libraries.

Any good installation program will check to see that the target computer contains the required Microsoft os DLLs and update them if necessary. The term for that is typically called "DLL Hell!" Normally if the program is compiled without debug information and installed in XP or newer os then there won't be a problem. The real DLL problem occurs when you use win32 api functions and/or features that require a minimum of one version of Windows (such as Vista) and you want to install it on a computer that has an older version of the os.

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

Our current administration is not only making deals with but relying on the very powers that our "Democracy" has fought against for years! We don't belong borrowing money from or teaming up with China or any other Communist nation as they are completely on the opposite end of the spectrum of our countries original beliefs!

Its not just the Obama administration, but every President for the past 50 years (probably since WWII). And most notably over the past 10 years. China doesn't have to beat USA at war -- its buying us.

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

can u explain it please...........

The code snippet I posted opens a text file and reads it one word at a time. What I did not post was the requirement to compare the words read with some other string -- I left that up for you to do.

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

AFAIK it is not possible to time a specific thread as if that thread were the only thing running on the operating system (windows in this case). One reason for that is because the os will perform thousands of context switches while the thread is running, so any time you try to calculate will include the time all those other things are doing as well. So any profiling you attempt will only be approximates, not absolutes.

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

if I ftp any work doc in binary format or asicc format and view the resulting file they are all fine. ftping the copied file that my binary creates does not work fine. So not too sure it's an ftp issue.

What o/s are you using to copy file?

I am using Microsoft Vista Home Premium and VC++ 2008 Express compiler. No FPT involved. Are you using the code I posted or something you wrote ?

Where did the input.doc file come from that you posted? Was it also FTPd to Windows machine before you posted it here? Or did you post it directly from a browser running on Solaris os ?

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

Oh, I just saw the attachments. Downloaded input.doc and my program copied it correctly, as expected. The output.doc file you attached is unreadable for me too, so the problem is either in the ftp or the solaris operating system. My guess is the ftp program is corrupting the output file.

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

There might be ftp problem. And I don't know what will happen if you try to copy MS-World doc file on your solaris operating system.

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

use the >> operator

ifstream in("file.txt");
string word;
while( in >> word )
{

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

Of course that can be done -- if you want the old information deleted when you open the file just specify ios::trunc as the second argument in the open statement. ofstream out("file.txt", ios::trunc); Look here for complete reference.

[edit]Maybe I misunderstood the problem. See ^^^ post.[/edit]

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

You need a vacation if you are dreaming about google :)

jephthah commented: truth +12
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The microsoft word doc is copied successfully - byte per byte. Copied file is same size as original. However, when I try and use microsoft word to open the copied file, the copied file contents which have non-ascii text are not readable. The ascii text is readable. So the copied file is worthless to the end user if he/she cannot see the non-ascii parts. So I want to be able to copy the file AND open it and read it successfully using ms-word.

Zip up the file you are trying to copy and post it so that I can test it. The doc file I tested is readable by MS-Word as expected, and it contains quite a bit of graphics and charts, so there is no reason that program does not work with any document.

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

>>I do not know how to use FILE for writing data.
Excellent :) Don't use it in c++ programs. Use fstream, ofstream or ifstream objects.

Nick Evan commented: yup +20
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

line 1: should be <iostream> -- no .h extension. If what you are reading tells you to use iostream.h then stop reading it right now and read something else.

line 2: delete it. conio.h is non-standard and its use is discouraged in c++ programs.

line 5: put that } on a new line where its easy for you and anyone else reading your program can see it.

line 15: delete that line

line 16: replace getch() with cin.get().

After line 1 you will need to add this:

using std::cin;
using std::cout;
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Bummer! There's not much I can do for you without that file, or something similar.

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

>>If you need other pieces of the code I'll post them here...

Please don't. Post all your technical questions in one of the language boards. I would move this to the right place if I knew what computer language that code was written in.

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

tutorial

Lots of good books here

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

You mean the files are on the unix accounts at school and they won't give you a copy so that you can work with the files at home?

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

add -lmingw32 -lSDLmain -lSDL to the Linker parameter in additional command-line options

(project menu, project options, parameters tab)

Nothing like being 2 years late :(

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

That's just plain silly and grossly inefficient:icon_eek: ! -- the return value will the the same every time you call that function, so just call it once and save the return value then.

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

I think your formula is incorrect. See this

int main()
{
    float f = 82;
    float c = (f - 32.0F) / 1.8F;
    cout << "c = " << c << "\n";
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

How would I use new and delete?

you are kidding aren't you? You mean you don't know diddley-squat about c++ yet you are attempting to write a windows program :icon_eek:

if(hFile != INVALID_HANDLE_VALUE)
    {
        DWORD dwTextLength;

        dwTextLength = GetWindowTextLength(hEdit);
        // No need to bother if there's no text.
        if(dwTextLength > 0)
        {
            char* pszText;
            DWORD dwBufferSize = dwTextLength + 1;

            try
            {
                pszText = new char[dwBufferSize];
                if(GetWindowText(hEdit,pszText, dwBufferSize))
                {
                    DWORD dwWritten;

                    if(WriteFile(hFile, pszText, dwTextLength, &dwWritten, NULL))
                        bSuccess = TRUE;
                }
                delete[] pszText;
            }
            catch(...)
            {
                // allocation failed
            }
    }
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I compiled the *.cpp file with VC++ 2008 Express and got some errors

1>c:\dvlp\wintest\wintest\wintest.cpp(23) : error C2440: '=' : cannot convert from 'HGLOBAL' to 'LPSTR'
1> Conversion from 'void*' to pointer to non-'void' requires an explicit cast
1>c:\dvlp\wintest\wintest\wintest.cpp(61) : error C2664: 'SendMessageA' : cannot convert parameter 1 from 'int' to 'HWND'
1> Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
1>c:\dvlp\wintest\wintest\wintest.cpp(64) : error C2664: 'SendMessageA' : cannot convert parameter 1 from 'int' to 'HWND'
1> Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
1>Build log was saved at "file://c:\dvlp\wintest\wintest\Debug\BuildLog.htm"
1>wintest - 3 error(s), 0 warning(s)

As for the first error: GlobalAlloc() returns a HGLOBAL object, not a char*. And GlobalAlloc() is just an unnecessary complication, just use standard c++ dynamic memory allocation, such as new and delete[].

The first argument to SendMessage() must be a window handle HWIND, not a macro from the resource.h file.

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

As a user I almost never use site maps, I have never found a use for them.

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

It has no sense at all to disable UNICODE !!
It's the standard !
Windows itself is UNICODE (see Kernel or User source code..)

C++ language has no provisions for UNICODE, and Windows isn't the only os in the world.

Yes, standard ascii strings can be used in UNICODE enabled program, but don't try to pass them to most win32 api functions because it will not work.

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

>>which really works out to about 2Gig because Dev Studio

What is Dev Studio? You mean Dev-C++? In any event it has nothing to do with the problem and does not affect the amount of memory a program can use, unless the computer has less than 2 Gig of RAM and is out of hard drive swap space.

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

>>g++ -o my.out:shape.o brick.o Exo.o

What is that colon doing there between out and shape.o? I think it should be a space and g++ is not recognizing shape.o as an input file.

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

You call that c++ code ???:D My suggestion to you is to scrap it and rewrite in true c++ -- a program without all those C style functions calls.

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

I don't know how to enable 64-bit. From what I see in the link I posted, and read in other places, its enabled during installation of the compiler. There is apparently an installation option that lets you install the 64-bit compiler. You may have to reinstall the compiler in order to get it.

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

I just tested a short program and it stopped at about 2Gig just as you had also reported. I believe the reason is a 32-bit program can only access 2 Gig RAM.

To get the 64-bit version of VC++ 2008 you have to select an option during installation. Here is how to do it.

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

>>Visual Studio 2008, which I assume is a 64 bit compiler.
No -- its a 32-bit compiler. But the Pro version can compile 64-bit code if you provide the right options. Just because you compile something on a 64-bit os doesn't mean you will automatically get a 64-bit program.

Post a short example program that produces the problem you are talking about.

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

Ok, here is some help -- I've reworked part of that function, you should be able to finish it. There are more you could do to make it even better, but we'll just start with this format. Write the other case statements in a format similar to the one I wrote for case 2.

void ProcessChoice(int c) 
{
    string line;
	string name;
	char gender;
	int age;
	int ss;
	int smoke;
	int HBP;
	int HFD;
	int points;
	ofstream outFile;
	ifstream inFile;
	
    switch (c)
    {      
        case 1: // Enter new patient
            outFile.open ("records.dat", ios::app);
            cout << "Name: ";
            cin >> name;
            cout << "Gender: ";
            cin >> gender;
            cout << "Age: ";
            cin >> age;
            cout << "SSN: ";
            cin >> ss;
            cout << "Smoke: ";
            cin >> smoke;
            cout << "HBP (0/1):";
            cin >> HBP;
            cout << "HFD (0/1):";
            cin >> HFD;
            cout << "points (0/1):";
            cin >> points;
			
            outFile << name <<",";
            outFile << gender <<" ";
            outFile << age <<" ";
            outFile << ss <<" "; 
            outFile << smoke <<" ";
            outFile << HBP <<" ";
            outFile << HFD <<" ";
            outFile << points << endl;
            outFile.close();
        break;

		
	case 2: // List All Smokers
            inFile.open ("records.dat");
            if (inFile.is_open())
            {
                while( getline(inFile, line) )
                {
                    stringstream str(line);
                    getline(str, name, ',');
                    str >> gender >> age >> ss >> smoke >> HBP >> HFD >> points; 
                    if (smoke == 1)
                        cout << name <<", "<<"Gender: "<<gender<<", "<<"Age: "<<age<<", "<<"SS# "<<ss<<"\n";
                }
                cout << "Press Enter when ready\n";
                cin.get();
            }
            else …
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Currently our overall national debt is 2.5 trillion pounds (under 5 trillion dollars) but thats between 60 million or so. I aint got a calculator but thats wayyyy more per person than the USAs debt burden is (like double?)

'

Do you mean $60 Million per person?? I looked it up on the net and as of June 2009 it is about $60,000 USD (or about $36,000 pounds)per person in USA.

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

The error message is quite clear -- you failed to code the function named get_record().

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

That error message is quite explicit -- you have coded that function more than once.

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

line 88 of the code you posted: You can not code a function inside another function. Write that function outside any other function then just call it on line 88.

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

On an unrelated note: is there some minimum amount of time that has to pass before thread subscription will "instantly notify" me? For example (and this happens a lot) I posted a question, you answered and I received an email about this answer. Then I replied. Then you replied, and I didn't receive an email - am I misinterpreting the expected behavior?

Thanks,

Dave

I don't know because I don't use that feature. Please post your question in DaniWeb Community Feedback.

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

Are you going to pre-order Windows 7? I have and got the Pro edition because it contains XP compatibility mode.

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

It's part of the new "c++0x standard" called "delegated constructors".

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n1986.pdf

I didn't see in that document where int x = 5; would be a legal construct. As far as I can tell that document is talking about class constructors, not variable initialization outside the constructor.

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

Well if you don't like it where you live then go live somewhere else where you think you would be happier, such as China, N. Korea, Russia, Iraq, Iran etc. etc. No one is forcing you to live where you are. Sure, its not perfect, but its a lot better than most other places on Earth. And in USA you won't get shot for voicing your opinion. Hell, we'll even let you burn the American flag in public if you want to.

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

c++ does not allow initialization of variables like that. No c++ compiler on earth will do it. What you might be referring to is const int x = 5; , which is allowed but not implemented by all compilers.

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

assign.cpp calls read_accounts() twice -- why???

line 87: >> strcmp(accountList.get_accountNumber(),tranAcct)==0;


that should be an if statement -- without the if the loop will not work correctly. if( strcmp(accountList[i].get_accountNumber(),tranAcct)==0)

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

post the header file that defines Rectangle class and the code brick.cc

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

Nope. Reduce the value to 2, which is what the OP wanted and test again.
Here is the result of what I get when I enter 30 digits, that's because a 32-bit integer can't hold 30 digits.

123456789012345678901234567890
-858993460
Press any key to continue . . .

and the same with 64-bit integer

1234567890123456789012345678901
-3689348814741910324
Press any key to continue . . .

int main()
{
    __int64 input;
    cin.width(30); // reads max 30 characters/numbers
    cin >> input;
    cout << input << "\n";
}

change the data type to a character array and your method will work

1234567890123456789012345678901
12345678901234567890123456789
Press any key to continue . . .

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

Here is a tutorial

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

Look at the link in adatapost's post???

Yes -- you see those blue letters? That a link, just take your mouse and click on it.

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

use the iomanip header

cin.width(30); // reads max 30 characters/numbers
cin >> input;

Nope, that doesn't help.

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

It will probably depend on your education level -- are you college freshman or going for a Ph.D.? The difficulty of any project will depend on that.

Is this for a computer language course (which one) or something else?

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

What more information could there possibly be??? As you already stated its just a pointer to the current c++ class object.

For example, here's the output of the following in c++. It shows that the this pointer is the same in both child and parent.

A:  this = 2afc38
B:  this = 2afc38
Press any key to continue . . .
class A
{
public:
    A() 
    {
        x = 0;
    cout << "A:  this = " << hex << (unsigned int)this << "\n";
    }
private:
    int x;
};

class B : public A
{
public:
    B()
    {
        y = 0;
        cout << "B:  this = " << hex << (unsigned int)this << "\n";
    }
private:
    int y;
};


int main(int argc, char* argv[])
{
    B b;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

II have written code that can successfully read and write a microsoft word doc - that is if the word doc contains plain text only

That isn't a microsoft word doc, but a normal text file.

. If there are any headings and different fonts used, these are not copied successfully. Which brings me back to my original question - when copying word docs does one need to manipulate the non-ascii chars? And how is this done?

See the code I already posted and which you quoted. If all you want to do is copy the file then the answer to your question is NO.