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

Just add a button, set it's property to hold a picture, then add the picture of the arrows. In the OnClick event handler change the picture from up to down, or vice versa and set a BOOL flag accordingly. The hardest part is finding the two pictures you want to use, or use the icon editor to create your own.

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

what arrow? I guess you want to add another button with an arrow, like a toggle between up and down.

Is that an MFC program?

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

your attachment is unreadable. what compiler, operating system, and gui library are you using? But it should be a simple thing to place a button wherever you want it and add the text "up" or "down", but maybe a checkbox would be better suited for that.

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

it does not have a Timer function as CWnd::OnTimer

Not to worry, SetTimer() is a global win32 api function, so just call that in CWinThread.

Is there any way i can implement a timer based function inside a CWinThread, being also able of course to accept messages coming from other threads?

Messages are thread specific, one thread can not get another thread's messages. See Remarks here

would like to send messages to the thread

CWinThread is not going to help you with that. Just create a worker thread and call PostThreadMessage()

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

That means the function may return without a specific return value. When the condition on line 6 is false, what does the function return? Why not just rearrange it so the function aways return 0 on line 21.

LONG APIENTRY Esl_CheckCMTClassRecord(struct CMT_Class_Record *ClassRecord, long *ret)
{
   USHORT uResult;
   SHORT retcode;
   uResult = bt3Start(Class.CMT_fd,Class.CMT_data);
   if(uResult == CLASS_RECORDLENGTH )
   {
       memcpy(Class.CMT_data, ClassRecord , CLASS_RECORDLENGTH);
       retcode = bt3FindRel(Class.CMT_fd, Class.CMT_data, FR_EQUAL);    // Read CMT record
       *ret = (retcode > 0) ? 1 : 0;       // read successful
   }
   return(0);
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Have you tried using a more modern version of visual studio compiler? Like VC++ 2010 Express (free) or just-released VC++ 2012 Express (also free)? Neither of those versions of vc++ need or use the windows SDK.

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

You have to enter product keys before it will install, can't do it later.

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

Did you try it yet? The computer probably must have an installed version of Windows, that's why it's called "upgrade" afterall.

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

inline assembly is not standard, so it all depends on what compiler you are using. VC++ does not allow dw opcode.

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

ok a portion of the hex dump:

Just as I suspected, that is not a text file. The first three bytes indicate it is written in UNICODE format, where each character occupies two or more bytes. All you have to do is fread it b ack in as UNICODE strings.

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

You do indeed need two files, one for read and temp for writing as you have done in the first part of your program. What you don't need is to rewrite temp back into the original file like you did at the end of the program. Just delete the original file and rename temp to the name of the original.

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

line 27 - 30 can replaced by deleting the original file then renameing the temp file. It's not necessary to rewrite the data again.

As for your specific question, can't answer that unless I have a copy of the file you are trying to work with.

on average about 1 of every 2 characters

Sounds like it's a UNICODE file, not a text file.

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

You mean something like this? Of course it will all depend on how the file was written -- what are its exact contents.

istream& readFile(istream& in, double& dbVal, char& charVal, int& intVal)
{
   in >> dbVal >> charVal >> intVal;
   return in;
}

int main()
{
    double dbVal;
    int intVal;
    char charVal;
    ifstream in("file.txt");
    readFile(in, dbVal, charVal, intVal);
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I don't think so. It used to tell us about all the benefits of donations, but I can't find it any more.

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

look at the bottom of the page, there is a link titled "Donate"

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

The ID_FILE_OPEN part of your program works ok for me, I just copied and pasted it into an existing win32 api project.

line 75: WwinMain should be WinMain, there is only one 'W', not two.

As long as you have the windows header files and libraries it shouldn't matter what compiler you use. I use either vc++ (Microsoft) or Code::Blocks with MinGW (Windows port of gcc). But other 32-bit compilers should work too.

Yes, you have to include commdlg.h because that's where the struct is declared. Look at the end of this page and you will find where it's referenced.

Don't get discouraged if you get confused and find win32 api difficult to understand, everyone has those problerms. That's one reason not too many people code like that any more.

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

Post the code you tried, otherwise can't help you. In the OPENFILENAME structure, make sure lpstrFile points to a character array that you created and the first byte of that array is '\0'.

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

line 22: The loop is running once too many times which overflows the array. Should be
i<MAX_TEXT_ROWS and not i<=MAX_TEXT_ROWS. Same problem in other similar lines in your program. Arrays always start at 0, so the last valid member of an array is MAX_TEXT_ROWS-1.

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

Remove the space just before the colon in the fscanf() format specifier string. Not sure it will fix it but worth a try.

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

your program is missing three parts, not just one as shown in the comment on line 15.
1. Before line 13 display the value of r and the '!=' so that if r == 1 it woould display "1!=".
2. Inside the loop at line 15 display the value of c and if c != r then also display 'X'.
3. The third piece is after the end of the loop, between lines 16 and 17, you need to display the value of the computed factorial.

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

you don't need two nested loops, just one will do that counts backwards from 's' to 1. Inside the loop you just need to print the value of the loop counter and 'X' as well as calculate the factorial of s.

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

fscanf() reads dataa from the file directly into a variable, it is not necessary to do other transfers. The parameters to fscanf() must all be pointers to your program's variables so that fscanf() can change their values. In your example you need to do it like this:

char temp[80]; // the tag name
int rows;
int columns;
// etc for each variable

fscanf(infilep, "%s: %d\n",  temp, &rows)

In the above you see that char arrays are always passed as pointers so there is no need to use & operator on them. Another way to do it, if you like using &, is like this: &temp[0], which creates a pointer to the first character in the array. Either way of coding it is correct.

The problem with using fscanf() like the above is that you can't scramble the lines in the fine and still get the same results. Once you write the program the file format must be written in stone. If you take my original suggestion then the lines of the file can be in any order you wish, the program is not dependent on the file order and vice versa.

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

That is a common file format for a *.ini file used by many MS-Windows programs that contain startup information. You can't store the data directly into a variable using fscanf(). Instead you have to call fgets() to get a line of text, find the colon in the line, then call a series of if statements to use strcmp() on the first part of the text, commonly =called tags. Once a tag name is found you assign the value to the appropriate value. For example, if the first line is read from the file

char line[80] = "rows: 5"; // this is read in a loop from the file
char* ptr = strchr(line,':');
*ptr++ = '\0';
if( strcmp(line,"name") == 0)
   name = atol(ptr);
else if( strcmp(line,"another name) == 0)
   AnbotherName = atol(pointer);

 // etc. etc with more if statements
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The reason for the restriction is to keep bots from spamming people via PM. [edit]Sorry, Mike already said that.

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

I was thinking of "Power to Affect Someone's Reputation Positively".

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

Correct! BWT: My name is NOT "sir". Only my dad was "sir" and people who don't actually work for a living. I prefer being called either AD or Mel.

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

Theoritically, yes, but no one has thousands of rep points. Look at my profile, it has one of the hightest on DaniWeb yet I only affect +14 or -3 points, depending on whether I vote up or down and leave a comment. The reason for such a small amount is because we thought I and others like me should not have to power to completely destroy someone's rep with just one vote. Before Dani changed the system a year or so ago I refused to downvote anyone because he/she would never be able to recover from it. Dani implemented a rep system that is today a lot more fair to everyone than it was two years ago.

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

most rep points are produced by members voting a post with the up or down arrow and leaving a comment. No comment means no points given. Other rep points are given by the system after certain intervals of posting, new members are given 10 points. The amount of points you can receive depends on the rep points that the member himself/herself has acquired. If you want to find that out just click the member's avatar and a screen will appear that will give you that information as well as a lot of other info about the member.

deceptikon commented: Good answers. :) +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

cl.exe can only be run on Windows 2000, Windows XP and Windows Server 2003 operating systems

That's probably an old link -- it also runs on all current versions of MS-Windows. You don't have to use vc++, there are other options such as the popular Code::Blocks with MinGW compiler.

Any GUI library will work, you can even make one as a console program. It all depends on how fancy you want to make your IDE.

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

Same problem reported here yesterday

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

even vc++ 2012 which was just released does not support long double.,

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

Your program is not checking for the existance if the file, it just assumes the file always exists. You need to check for NULL return from fopen() and do nothing if NULL was returned.

BTW: Don't call rewind() after fopen() because its a waste of effort, the file pointer is already at the beginning of the file.

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

Here is an example I wrote in 2009 that uses Sqlite in a c++ program. I don't know about the c++ wrappers you mentioned because I have not used any of them.

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

Is creature.h spelled "creature.h" or "creatures.h" -- your program contains both spellings.

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

If the C source code file is written in C and I can't compile it in a C++ compiler (so I'm told)

They told you wrong.

There is no problem at all mixing C and C++ files in the same program, I've done it several times. It's all in the file extension, the compiler sees a *.c and knows that it has to compile it as C code, and if it sees *.cpp extension the compiler compiles it as c++ code. No other special things have to be done to the source files or the compiler flags. sqlite.h already contains the preprocessor flags needed to tell the compiler that all the functions are written in C instead of C++ so that the header file can be included in c++ programs.

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

I haven't see it and I'm using IE9 which I just reinstalled last night.

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

The best way is to use portable libraries such as QT and boost. That way you write just one program without all those preprocessor statements. There are quite a few cross-platform libraries to choose from, which one you choose will depend on what you are trying to accomplish.

I've heard that there is a C# compiler for *nix, but I've never tried it. You might want to read a few of these google links.

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

I don't quite understand how the data is to be sorted. Is it according to column 2 minus the value of column 3?, for example for Kelvin it would be 170-58 = 112

Put the data into a structure then sort the structures

struct data
{
   char name[20];
   int a1;
   int a2;
   int diff;
 };

 struct data array[255];

Read the data into the above array then sort the array on member variable diff.

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

So you can do something like this

Or just use sprintf()

char filename[40];
sprintf(filename,"03/%s.txt", sn);
// filename = "03/1234.txt"
dx9_programmer commented: haha yes of course +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You won't find anyone here who will write your program for you, so you might as well try to do it then post the questions you have.

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

what you need to solve that problem is to study is probability theory, not computer science. Pay attention to the section Discrete probability distributions

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

Could be this problem

triumphost commented: Similar +6
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

line 18: can't do that because there is no memory allocated for the vector.

Data.push_back(Pixels[(Foo.Height() - 1 - I) * Foo.Width() + J].RGBA.B);

If you can calculate the size needed beforehand, then call Data.Resize(X) to allocate all the memory at one time, then I think the rest of your program will work as written.

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

and i would display it using fgets correct?

Not quite, remove the & before the three variable names. You don't need to put & to get the address of a char array.

lines 30-35: Notice that the three if statements are all identical. In order to get the correct file name there must be three distictively different test conditions.

Also, I think you want && not ||. You want to test for John AND Wanth AND Doend in order to read file named 03/1234. There might be two or more files that duplicate any one or more of those names, so to get the right one all three must be present at the same time. Very similar to the way you would find someone in a telephone book.

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

lines 35 and 48: don't use while statements, just simple if will do because all its doing is testing if the file is open, and if not exiting the progrm. while is unnecessary.

line 50: while not necessary here either. If the file was opened correctly then everything within that while statement will get skipped because inFile will not be NULL and your program isn't reading anything from the file.

The code you posted osn't reading the input file at all, just getting data from the keyboard.

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

ignore the above -- you started another thread.

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

It's not a pointer problem, just output problem. Try adding fixed to cout

outFile << "Value: " << fixed << company[i].budget_value << endl;

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

post the whole program. This works ok for me using vc++ 2012 RC

#include<string>
#include <iostream>
#include <fstream>
using namespace std;

struct budget
{
    int budget_num;
    string name;
    float budget_value;
};

const int SIZE = 15;
int main()
{
     budget company[SIZE], *ptr;
     ifstream inFile("ledger.dat");
     ofstream outFile;
  //while(!inFile)
    {
        //Same junk output for this
        for(ptr = &company[0]; ptr < &company[SIZE]; ptr++)
        {
            cin >> (*ptr).budget_num;
            cin >> (*ptr).name;
            cin >> (*ptr).budget_value;
        }

        //As this
//        for ( int i = 0; i < SIZE; ++i )
//        {
//            cin >> (company[i].budget_num);
//            cin.ignore();
//            getline(cin, company[i].name);
//            cin >> company[i].budget_value;
//            cin.ignore();
//        }

    }

    for(int i = 0; i < SIZE; i++)
    {
    cout << "Number: " << company[i].budget_num << endl;
    cout << "Name:   " << company[i].name << endl;
    cout << "Value:  " << company[i].budget_value << endl;
    cout << endl;
    /*
    outFile << "Number: " << company[i].budget_num << endl;
    outFile << "Name:   " << company[i].name << endl;
    outFile << "Value:  " << company[i].budget_value << endl;
    outFile << endl;
    */
    }
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Or you could just write your own program. What's so difficult about writing a program that does nothing more than blindly split a file into small chuncks? It could be written in maybe 15 minutes. Of course people who don't know how to program couldn't do that, but that's not the case here.