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

I use char ledStatus instead of BYTE ledStatus. is there any difference??

BYTE is defined by Microsoft windows.h as unsigned char.

line 3: what is "staio.h"? is it "stdio.h" misspelled?

but the code doesn't work.

What to you mean by that? Does WriteFile() return success? Yes or No. Does your program compile without errors?

Does your computer even have a printer port? Most new computers don't because they are USB ports.

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

Ok, thanks Dani. I guess I'll use Chrome when I want to do that.

[edit]I just installed Chrome (again), it works ok.

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

This is an example of what it looks like on my monitor using IE9

Untitled39

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

When I want to copy all the code into the clipboard all I do is double-click then copy. That works ok. But what if all I want is a few lines of the code to paste into an existing program? There is no way to do it because when I double-click the code everything is scrunched up into one line on the screen. If I just highlight lines then press Ctrl+C all the line feeds and tabs are lost when I past it into the vc++ editor.

So any other suggestions how to easily do it, except for just retyping it of course.

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

my IDE says the thread exits with a code 0

0 normally means the program ended with no errors, it ended normally.

What is your program not doing correctly?

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

The whole purpose of critical sections is to block out other threads while inside the code bounded by critical section. If other threads were allowed in then the critical section concept would be useless. Critical sections are pieces of code that are shared among threads -- I see no such thing in the code you posted.

What you are looking for is implementation of a mutex. Mutex's, not critical sections, are used to synchronize access to a single object among two or more threads. main() should create the mutex and each thread access it. If you are compiling for MS-Windows then you need to call the win32 api CreateMutex()

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

Diablo III -- I spend several hours a day at it. I've been playing the Diablo series from Blizzard for over 10 years!

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

Here's the correction, you can't combine all that like you did

//Now we just do some variable minipulate incase the user decided to enter a full name

inital = inital.substr(0,1) + ".";
inital[0] = toupper(inital[0]);

//return the inital
return (inital);

}
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

what are the eror(s)? Line up the { and } so that they are in the same column on the screen. Same for case statements, they should not be indented like they are shown in your post. Something like this example. Note: Your post will keep the spacing if you replace tabs with spaces. IDEs usually have an option to do that for you.

int main()
{
   if( something )
   {
       switch(x)
       {
          case 1:
             // blabla
             break;
          case 2:
            // blabla
            break;
          default:
            // blabla
            break;
        }
    }
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Several people often share the same computer at home, each person has his/her own login account, parents usually have Admin permissions, while children do not. The same is true with public computers in places like libraries, hotels, etc.

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

Sorry, but most of us have worked to hard to learn this stuff just to give it away for nothing

I usually offer to do it only after they deposit $1,0000,000.00 USD in my PayPal account :)

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

We will HELP, but we won't write it for you. Post some code to show us what effort you have made to write the program, then ask specific question(s).

Start out by creating a character array of 16 questions and their answers. Then in main() create a loop that asks each question, waits for a response, then check the user's answer against the correct answer. You will need two int counters, one to count the number of correct answers and the other to count the number of incorrect answers.

Don't attempt to write all this at one time. Code a little bit, compile, correct errors, then repeat. Many new programmers make the mistake of attempting to write everything all at one time, which can lead to millions of error messages and a lot of confusion. So take it in small steps, even professional programmers do that when they write large programs.

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

Or place them in the Recycle Bin

Horrible suggestion, empty the recycle bin and they will be deleted and forever lost.

Anyone that has access to the system can display hidden files

Not true -- you need admin privledges to display them. Log in as Guest then attempt to change a folder's properties to hidden, you have to enter the Admin's password.

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

Why don't you just delete lines 4, 6 and 8 then add an ELSE COMMIT TRANSACTION after line 13? That puts everything in the same transaction.

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

probably because the loop on lines 17 and 43 either 1) overflows the size of the arrays or 2) overflows the largest value that can be stored in an int, or 3) or both 1 and 2. Do the math manually with pencil & paper and you will see what is happening.

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

put it in a frame at a slight angle and call it Art...

Good idea -- I'll think about that. I've heard about artists who put human feces in a jar and sold it as art for several thousands of $$$.

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

Another option is to create another thread that calls Sleep(15*60*1000) (15 minutes) in a tight loop.

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

I have a copy of Visual Studio 6.0 just sitting in a box in my desk at home and have not used it for several years now because its too old. Any ideas how to make something useful with it or what to do with it, except toss it in the trash bin? AFAIK it would not be legal to sell it on eBay or CraigsList.

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

[edit]^^^ LOL exactly the same approach I was suggesting.

One thing you could do is to typecast marks to int and switch on that, but that's kind of long-winded and isn't very appealing.

switch( (int)marks )
{
   case 100: case 99: case 98: case 97: case 96:
   case 95: case 94: case 93: case 92: case 91: case 90:
       // blabla
       break;

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

Resources may be part of it, but VC++ 2012 Express is also slow to start. My guess is the way it reads the project startup file(s).

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

if( marks >=0.00 && marks <= 39.99 ){

That may not work in all situations. What if marks == 39.991 (which could easily happen with floating-point math on compters). None of the conditions apply so no grade will be assigned. What you should do is something like this:

 if( marks >=0.00 && marks < 40.00 ){
    // blabla
} else  if( marks >= 40.00 && marks < 50.00 ){   
   // blabla
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

In Windows Explorer right-click on the folder, select Properties from the drop-down menu, then check the Hidden checkbox. It's not possible to hide them from anyone with Admin rights.

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

The best solution is to use threads -- but Turbo C is too old for that. Either get a new compiler (free) or forget about your program.

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

It's my fault, I deleted the jpg attachment after I found out that it worked.

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

your quote is not right

character=getch() -- notice that getch() is a function call It retrieves a single character from your computer's keyboard buffer.

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

Still doesn't work with *.cpp or *.h files. And I get the same error when I try it on a new thread. Works with jpg as you can see

e filetype you are attempting to upload is not allowed.

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

Probably, unless the data is already nearly sorted. Study this article

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

you can divide by subtraction. Try out a few examples using pencil & paper to find out how its done. Or read this tutorial

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

It's all in the file extension. *.c files are read as C programs.

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

Does that also happen with other web sites? What country do you live in? Do you have an antivirus program always running? How much memory does your computer have? Does your computer have enough free hard drive space?

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

Yes, I like it, with the exception that Microsoft dropped support for Windows Forms in their CLR/C++ templates. Not sure if the compiler will compile it or not if you have a WF program started by an earlier version of the compiler/IDE.

Unfortunately I think it's a little slow starting up; they need to work on that.

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

Later edit: note also that the Markdown syntax of formatting the code is unavaible from my browser

Huh? Just hit the Code button and paste your code inside it. you don't manually add any markdown code to it.

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

It might be useful for just browsing the forums, such as when a student is in class and wants to search for something. But even then it would be difficult to read a long-winded post with lots of code.

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

I suspect Gene is using Turbo C++ which is an ancient compiler and knows nothing about modern header files such as <fstream> and <iostram>. If that's true, then he needs to use fstream.h

As for standard namespaces, Turbo C++ doesn't require explicit declaration of it because its in the header files.

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

A "scientific" explanation of "electricity just stopped working".

That is about as scientific as some people can handle. Some members post crap like that all the time in the C/C++ forums -- "my program doesn't work, fix it immediately because I'm late for my class"

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

because after answering the "Do you want to continue" prompt you have to enter either Y or N then the <Enter> key. cin >> does not remove the Enter key so its still in the keyboard buffer. There are several ways to remove the Enter key, one of them is to call cin.ignore() after cin>>ans. Another it to just make ans a character array of two or more bytes so that cin can remove the Enter key.

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

I don't know the answer, but you should no longer use Windows Forms with C++ because Microsoft dropped it support in the newly release VC++ 2012 compiler. I mentioned that only in case you are trying to write a Windows Forms program in CLR/C++. If not, then ignore it.

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

maybe you have dyslexia :)

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

Sorry to hear about your illness, that happens to everyone. When that happens to you after you start working do you really expect other people to do all your work for you?? It ain't going to happen. If you don't remember how to do it then you need to refresh your memory by re-reading your text book and studying the examples in it. Or just drop the course and take it again next semester.

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 mean UK government pays people to write web sites? No wonder your taxes are high :)

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

Look at the function prototype on line 7, it has two arguments. Now look at line 16, it is passing only one argument. The compiler is complaining because line 16 is not passing enough arguments. In main() declare an array of ints and add that array as the second argument on line 16.

The function that starts on line 24 is going to have problems. The first parameter, variable named "a" is a pointer, but you are using it inside the function as if it is not a pointer. It can't be both ways. I'd suggest you remove the pointer & opeator on both lines 7 and 24 because the function does not need a pointer for that variable.

Suggestion: you don't need both lines 12 & 13, and 17&18. Rearrange main() so that lines 17 & 18 appear only once in your program. You should find ways to eliminate repeated code in your programs.

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

Dev-C++ is not a compiler -- its only an IDE. MinGW is a compiler, VC++ is a compiler and an IDE as is Turbo C++.Which is best for MS-Windows? Microsoft VC++ of course because that is what Microsoft uses to develop MS-Windows. It's also best because of many other reasons, such as debugging, code completion, and project management to name just three.

Which is best for beginners to learn is quite another question. VC++ is difficult to learn because of its many features. I would say Code::Blocks with MinGW compiler is better for beginners. Dev-C++ might be a nice IDE but the version of MinGW that comes with it is not up-to-date, but for beginners that too many not be very relevant because most beginners won't be using the new features added by c++11 standards.

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

it depends on the operating system.

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

you could copy the ints into wchar_t variables or std::wstring. What characters are displayed on the screen will depend on what language(s) are installed in the computer. For MS-Windows also look into setlocale()

Ancient Dragon - is there a difference between the wstring and the char?

Yes, wchar_t is 2 or more bytes per character while char is only 1 byte per character. std::wstring is an array of wchar_t characters. std::wstring and std::string are not easily convertable from one to the other. Furthermore, the size of wchar_t is not constant from one os to another. On MS-Windows sizeof(wchar_t) is 2 while on *nix it is 4. I read a couple years ago that UNICODE standards committee is considering expanding it to 8 so that it can hold graphics characters used in some languages.