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

I don't understand the problem -- the code you wrote already reads floats. Or are you asking how to read a file where the floats were written as binary data instead of text? That all depends on how the file was written -- you will have to post the program that wrote it.

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

Your program was difficult to follow because it was formatted so poorly. Don't be afraid to use lots of white space to make it easier to understand.

The problem is that the array does not contain enough rows and columns -- there are four columns in the data file but only 3 in the array.

#include <fstream>
#include <iostream>
#include <sstream>
#include <string>
using namespace std;
int main ()
{
    string line;
    int row,col;
    float my_array[2][3];
    ifstream pFile ("yyy.txt");
    if (pFile.is_open())
    {
        row=0;
        while(!pFile.eof())
        {
            getline(pFile, line);
            stringstream ss(line);
            cout<<row<<"\n";
            col=0;
            cout<<col<<"\n";
            while(ss >> my_array[row][col])
            {
                col++;
            }
            row++;
        } 
        pFile.close();
    }
    else 
        cout << "Unable to open file"; 
    for(int i=0;i<row;i++)
    {
        for(int j=0;j<col;j++)
        {
            cout<<my_array[i][j]<<"\t";
        }
        cout<<"\n";
    }
    cout<<"\n";
    cout<<my_array[0][2]<<"\n";
    system("pause"); 
    return 0;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

when you copy your exe file to another computer copy the registry file to the same location.

Then you can progably change system("AvastPatcher/RunOnce.reg"); to just system("RunOnce.reg");

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

I assume you mean this machine. You will have to get the programming details from the manufacturer. Contract them and they will be able to help you.

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

>>Very first thing dont be so rude...
I'm not rude. If you want to see rude go to here and see posts by DaWei.

>>i want to mention is i have not use TCHAR as variable
Yes you did. In this line void convertStringBoolean(String* TCHAR) the use of TCHAR is a variable name, String is a type.

And while I'm at it I will suggest you upgrade to VC++ 2010 if you can because CLI langusage has changed since your version of the compiler. For example String* is now String^

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

>>false&quot;
What the hell is that???

>>void convertStringBoolean(String* TCHAR)
Don't use TCHAR as a variable name because it's a macro defined in standard header file tchar.h which expands to either char and wchar_t depending on whether UNICODE is defined or not.

What is the actual value of that string? Is it either "true" or "false", or is it something else.

Why don't you just say

bool convertStringBoolean(String* str)
{
   return (str == "true") ? true : false;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Learn to use google or read your text book. Parameters and arguments

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

on which line does the error appear?

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

Both terms mean the same thing -- they are what you pass to a function

void foo(int x) // x is a parameter
void foo(char *x) // x is also a parameter here

int main())
{
   int x;
   foo(x); // pass an argument to function named foo
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

don't pass that char* as a double pointer when all it needs is a single pointer int pop(node **hd, char *new_element) { Then it can easily be acessed new_element[i] = (*hd)->element[i]; If the above doesn't fix the problem then it is in how it's accessing hd pointer.


>>char *x = malloc(sizeof(char)*MAX_LINE_LNGTH + 1);
The use of sizeof(char) here is superfluous. sizeof(char) is guarenteed to always be 1.

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

I would suspect your program contains memory leaks. win32 api functions do not exhibit that type of problem.

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

Ok, here's a start. Now all you have to do is take this template and fill it in with the code you write. If you have not yet learned about ifstream and vector then you will need to study up on them. Every c++ textbook worth its salt will contain the information you need, or you can use google to easily find it online.

#include <fstream>
#include <iostream>
#include <vector>

using std::ifstream;
using std::cin;
using std::cout;
using std::vector;

int main()
{
   // put your code here

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

Since when did icode tags start working like code tags but without the line numbers?? I don't really care, but I like that change :) Or has it been that way all the time and I'm just not very observant.

I first noticed that behavor a few minites ago in this thread.

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

That file contains some comments at the top, then four colums of data. There are several ways to read the data, one of them might be to create a structure with 4 data items representing each of the 4 columns of data, then put that structure into a vector for each row in the file

struct data
{
   double col1, col2, col3, col4;
};

vector<data> rows;

Now write your program to skip all the lines that start with a semicolon or are blank, then use >> ifstream operator to read 4 data items into the structure and push the structure onto the vector.

I'm being a little vague about that on purpose -- I'm not going the write the program for you.

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

Most likely it's something else in your prograsm. Comment out the call to GetOpenFileName() then re-run your test to see what happens. My guess is that the program will still display the same behavior.

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

Here's a novel idea -- why don't you start with this

#include <stdio.h>

int main()
{
  // put your code here
}
kvprajapati commented: Great starts +11
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You need to check that fopen() returned a non-NULL pointer. It will return NULL if the file can not be opened (such as the file does not exist when opening for read or you don't have permissions to open for write).

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

>> I keep getting this error

what error?

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

I was basing my opinion on the number of titles we sell at my WalMart store. We have one 6-foot shelf for PC games but two 20-foot shelves for displaying Xbox, and Wii games.

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

you have to completly rewrite the file -- read the file into memory then write it back out but omitting the part you want to delete.

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

>>void Image::load_Image_From_BMP()
Why does that function not have a parameter?

>>load_Image_From_BMP(fileLink);

Check the contents of fileLink list. Maybe the problem is bad data in the list. Change your program to just display all the nodes of that linked list (or whatever it is) instead of actually calling the load_Image... function. That will let you visually verify whether the list is ok or not.

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

>>rec.state == statecontrol

You can not compare two strings like that. All that is comparing is the address of the two character arrays, not their contents. call strcmp() to compare the two.

Also, I suspect you will have big algorithm problems because of the two while loops that both read the same file. Reading should be done only in one spot, not two.

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

That function needs to be prototyped in McCauleyCurrencyConverterHeader.h

adaniel058 commented: Great help and quick reply. Thanks man +1
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>May be u need to re install Dev and hopefully probelm will vanish

Forget Dev-C++ because it has not been updated for quite a few years now. It's officially dead.

Get Code::Blocks with MinGW compiler (its all in one install package). You might want to uninstall Dev-C++ first.

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

Anyone else dress up for Halloween? If so, then post your pictures here. This is how I looked at my WalMart job today (3 pm - 10 pm)

AndreRet commented: Cool pic... +0
iamthwee commented: 10/10 coolest kid in the playground +0
WASDted commented: nice to see you +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Project --> Properties (last menu item) --> Configuration Properties --> C/C++ -> Output Files. Then in the right side of the screen change Assembler Output to whatever you want.

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

The point was that there were almost 800,000 members with less than 34 rep points. Statistically, that must be 99% of the members :icon_eek:

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

Then you have big problems because you can't solve it with c or c++. Try another language, such as fortran, which is more suited to numerical analysis.

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

To accomplish the undo option all you need to do is make a copy of the chessboard before any move is made. After the move then use that copy for the undo option.

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

I don't think I would want to get into a bar (pub) fight with either one of them :)

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

I gave someone rep this morning and increased his rep rank from #800,000 (or so) to #400 something :icon_eek:

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

maybe this

Also, for non-static methods it's customary to use the this pointer instead of class name, such as this->CreatePiece() instead of TwoDBoard::CreatePiece(). this-> isn't really needed either, but some programmers like to use it for clarity.

for (int iCol = 0; iCol < 9; iCol++)
		{
			int iTempPieceID;
			iTempPieceID = arrCurrentLayout[iRow][iCol];
			arrPiecesOnBoard[iRow][iCol] = this->CreatePiece(iTempPieceID, iRow, iCol);
			cout << "TEST" << endl;
			cout << arrPiecesOnBoard[iRow][iCol]->getPrintString() << endl;
		}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I didn't mean it was Windows 7's fault -- just wanted to know if it ever worked on Windows 7 Ultimate.

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

You might as well delete line 108 because that line will never get executed (unreachable code)

Just as I suspected -- line 34 dereferences an unallocated pointer.

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

>>a chess game that enables two or more players
Never heard of a chess game played by more than two people (or one person and a computer). There are only two sides in a chess game -- white and black. It would be interesting to find out how three people can play the same game without one of the people just being an observer.

In any event, your probblem is most likely attempting to access uninitialized pointers. Of course no one can tell you for sure because we can't see your monitor. Post the program here so that we can see it.

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

If you want programming advice then come to DaniWeb. But if you want legal advice then see a lawyer or solicitor.

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

Other than for the pure challenge of doing it, I see no reason to write a web site in c++ since there are other markup languages more suited for the task. I don't write web sites but my guess is that not a single one of them were written in pure C or C++.

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

The best way to get this straight in your head is to write a simple program that demonstrates what you do or don't understand. For example if you want to see what happens with a fill character then write a program that does nothing more than cout << setfill('0') << setw(15) << right << fixed << 123 << '\n'; Put just that one line in a program (inside main() of course) and run it to see what happens. Now change something, such as the fill character, compile and run again. Keep changing thigs and experiment to see how your changes affects the output of the program.

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

Isn't the use of utorrents illegal, such as downloading pirated software, movies, music, etc? Are there legitimate uses of torrents?

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

LEA means Load Effective Address -- so that will store the offset from the beginning of the data segment to the start of variable named VAR2 into the BX register. Read through this page.

MOV SI,OFFSET VAR1 does the same thing as LEA SI,VAR1

mov cl,[si] means to copy of value of the memory location whose address is in the SI register into the cl register. If the value at DS:SI is 10h then the value of cl after that instruction will also be 10h.

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

add << right to the cout statement. I like to split up long lines to make them easier to read without horizontally scrolling the code window. Note that I changed some of the widths you had set, but you can use whatever you want.

If you can you might want to display the column titles using two rows of text instead of one. That will make the columns narrower to fit better on the screen.

cout << setw(11) << left << months[i] << setw(8) << right << avgRain[i] << setw(10) 
              << actRain[i] << setw(8) << total << setw(8) << total2 << endl;
Intrade commented: Absolutely awesome. +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Use a loop and iterate through the array with the loop counter as the index into the array.

Here is another way it might be done using c++ algorithms

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

I'm running Window 7 64-bit Home Premium, and CB Version 10.05 with MinGW. Did not have any problems starting the debugger when I selected menu Debug --> Start

The first two images you posted are identical to the ones on my computer. I was unable to locate the screen you posted in the third image.

Have you ever been able to use the debugger with Windows 7 on your computer?

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

Look closely at line 157 and you will see that it is attempting to use salrate as if it were a single object, not as an array. You have to change either line 157 or line 17, but you can't use it both ways.

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

what exactly is the problem?

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

When your children are grand parents

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

Do you know how to use ifstream to read text files? If you do, then just read each line of the file and compare the line with the permuted string. It's a simple while loop.