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

I read the string back to decrypt, does not give the whole string back but truncate the string.

Then you are opening the file incrrectly. Since the file contains embedded NULL bytes it must be opened in binary mode and use std::string's read() method.

when decrypting I can avoid them?

You can't just ignore them because they are part of the encryption algorithm. Decryption will be rendered useless without them.

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

have you looked at boost file system fuctions? Boost may have already solved your problem for you.

Microsoft has not released the official exFAT file system specification, and a restrictive license from Microsoft is required in order to make and distribute exFAT implementations. Microsoft also asserts patents on exFAT which make it impossible to re-implement its functionality in a compatible way without violating a large percentage of them.

Quoted from here

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

So what's your problem? We do not do homework for you, you post the code you have written and ask specific questions. Just posting your assignment does nothing.

zachattack05 commented: So true +5
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

.Just wondering y did i not get this thought

Experience -- the more you program the easier such errors will be to identify and fix.

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

what parts of the program do you need help with? No, I'm not going to finish it for you.

Just complete the instructions one at a time. Look at the 1st instruction, does the program you posted do all that? Answer: No. So the first thing you need to do is to add code to the program to make it comply with instruction #1.

Instructions 1, 2 and 3 all apply to the word that is entered, not the guesses.

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

instead of scanf() call rand()

a[i][j] = rand();

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 don't need the braces on lines 8. 15, 20 and 23. Then reformat so that each line of code ligns up on the left side - no indention is needed.

Test it, run it, to find out if your program is correct or not.

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

yes, for example, the loop that starts on line 5 could be rewritten like below, which is more like what you might write in assembly programs. Although goto is not generally used in C programs, it does show your teacher that you understand how loops work.

int i = 0;
start:
if( i > (n-1))
   goto end
// do something

++i;
goto start;
end:
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Have they developed methods to effectively remove tattoos yet?

No, but they do coverups. If you don't like the one you have then cover it up with another one.

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

Anyone into tattoos? I'm not, never had one and don't intend to get one, but there's a couple new reality tattoo shows that I find interesting. One is Ink Master. Another is Tattoo Nightmares One thing these shows told me is that you have to be very very careful about who you let give you a tattoo, you will wear it the rest of your life so you don't want someone who is likely to f**** it up!

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

Sart here

int main()
{

   // put your code here

}
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

I just use google to look up the words I don't know how to spell (which is most of them)

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

Your compiler is too old to create the excel file directly, but you could create a *.cvs file which can be read by Excel. *.cvs file format is just a plain text file with tab-separated or comma-separated fields.

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

Here is one site I found

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

You have to read the file just like it was written, each node occupies 5 lines in the file. So in the function that reads the file it has to read all 5 lines in order to find the id numbers

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

If you want to get creative, use a third array as indirect addressing into the other two arrays

void sort(char* nm[], int a[], int index[], int n)
{
    int i, j;

    for(i=0;i<n-1;i++)
    {
        for(j=i+1;j<n;j++)
        {
            if (strcmp(nm[index[i]]) > strcmp(nm[index[j]]))
            {
                swap(index[i],index[j]);
            }
        }
    }
}

int main()
{
   char nm[3][5];
   int index[5];
   int a[5];
   for(int i = 0; i < 5; i++)
      index[i] = i+1;
   sort(nm,a,index,5);

   // print
   for(int i = 0; i < 5; i++)
   {
       printf("%s\t%d\n", nm[index[i]], a[index[i]]);
    }
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

use one of the arrays for comparisons, then when a swap is needed you swap the same elements in both arrays.

void sort(char* nm[], int a[], int n)
{
    int i, j;

    for(i=0;i<n-1;i++)
    {
        for(j=i+1;j<n;j++)
        {
            if (strcmp(nm[i]) > strcmp(nm[j]))
            {
                swap(nm[i], nm[j]);
                swap(a[i],a[j]);
            }
        }
    }
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

click the "Edit Profile" link in the purple ribbon at the top of the screen, then there is a Password edit box next to your email address, which appears at the top of that screen.

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

You are using the wrong compiler then because VC++ 6.0 knows nothing about .net. When you use ancient compilers you have to expect you will do some things the hard way. Upgrade to VC++ 2012, the Pro version will cost you about $500USD if you live in the USA. BTW I hope you also installed servoce pack #6 for that compiler because it was originally very buggy.

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

You can also use MSFlexGrid. It's fairly easy to use. You can get it when you install VB 6 then just add it to VC++ 6

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

There are lots of free grid controls for MFC, here is just one of them. Here is another list from codeproject.com, largest repository of MFC code on the internet.

If all you want is a read-only control then you could do with the standard List control.

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

Why isn't the smallest value in the remaining section only looked up and then swapped with index i at the end?

Because that's a different sorting algorithm. For small amounts of data or data that is already nearly sorted insertion sort is as good and fast as most others, maybe faster. IMO It's also the easiest to code and remember.

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

See answers to your other thread here

You call strcmp() to compare two character arrays, == doesn't work like it does for std::string class. To solve your problem you will have to first combine the two characters like I showed you in your other thread and then call strcmp() to compare it with another character array. Can't be done all in the same code statement.

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

You can't because both those functions only work on null-terminated strings. In your example, neither a nor b has enough room to hold more than one character. Then could be contantinated like this:

char a = 'a';
char b = 'b';
char all[3];
all[0] = a;
all[1] = b;
all[2] = '\0';
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

delete lines 26-31 because they are do-nothing lines. They are not calling any functions within class Bike, but just predeclaring global functions that your program never uses.

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

Have you written a design document yet? If not, then that's where you need to start.

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

You might read some of these google links to see if you can find a solution

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

also post the complete error message -- it tells you what function(s) is/are missing.

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

You posted your solution, but is there a question somewhere?

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

I forgot to mention that many compilers do not compile resourc files -- those with *.rc file names. Instead, you have to download a resource compiler and use it whenever you modify the *.rc file or resource.h header file. VC++ includes the resource compiler, and I think Code::Blocks does too.

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

is there any chance it will accidentally generate the same primary key more than once

No. The dbserver I used from Sybase would lock the table before writing anything to it. Table updates are queued up in the system and processed one at a time in sequence. You really need to read up on your database's documentation to find out how it handles multiple simultaneous requests.

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

sql databases can generate the numbers for you, just make one of the columns auto increment.

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

I don't find it all that useful, I think it's more convenient to just use the menu bar that appears across the top of the page.