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

See this related thread.. If the file really is not in the directory you posted then you might need to reinstall the .NET framework.

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

>>He seems to think he is a Moderator...is this true or is it all in his own head?
Does he have a moderator badge, like jbennet? If not then he is not a moderator at DaniWeb, but he could be somewhere else.

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

Using win32 api gdi functions you could disable the mouse by just hiding it then ignoring all mouse clicks. For keyboard, ignore the keyup and keydown events. Note that these are not standard c or c++, but win32 api functions. There is no way to do it with standard c/c++.

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

Oscar: your computer might be so slow shutting down because of the windows services that you have installed. Have you actually timed it with a watch to see how much time your computer takes to shut down? Or are you just mearly guessing?

[edit]I just timed my computer -- it took only 10 seconds to shut down, but one full minute for windows to boot (did not include the amount of time the hardware took to start the windows boot loader).

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

what is DFT?

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

Please i need d code for C.

Stop whining and begging. The code he provided is practically C.

Aia commented: Are you kidding? ...And this is practically a good rep. -1
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Besides the fact that they don't want it to look like windows at all, is it possible to really do what you said? Can the windows start button and search be eliminated? And they are talking about an on screen keyboard with a touch screen and no physical keyboard too.

There are lots of touch screens for Windows 7. Here are just a few

20+ years ago I wrote a touch-screen application for MS-DOS 6.X.

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

Sorry, I have not worked with images. Someone else will have to help you.

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

Well its actually even worse than that -- the solved post count does not include all the threads in which you helped solve the problem but the op never marked it as solved. If all of them were marked solved then my solved post count would be nearly 15,000 :icon_eek:

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

why not just take the existing desktop and remove all the desktop shortcuts and start menu items except those that you want to allow. That would be a lot easier (quicker and cheaper) than trying to reinvent the wheel (desktop). And that solution requires zero programming.

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

Maybe this old thread will help

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

Since my original Post, I've been credited with 4 Solved Questions., Surely that must mean something?
.

It means absolutely nothing. Being credited with a solved post doesn't mean you helped to solve it, it only means you made a post in the same thread. Just look at my solved post count for example -- I didn't really solve all those.

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

It will depend on the version of the compiler that is used. Declaring objects in the middle of a block like we can do with c++ is only supported by versions of C compiler that support C99 standards.

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

"%u" is for unsigned in, "%lu" is unsigned long int, two different int sizes.

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

C programs are allowed to declare variables only at the top of the block enclosed with { and }. So move line 42 up to line 16.

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

In its simplest form: g++ stock.cpp usestock.cpp -o myprogram <Enter> You can also install Code::Blocks which will let you easily create and compile multi-file projects.

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

>>The problem is, I don't know how many image files there are, until a run the program, and search a folder for the files.

Use either a <vector> or <list> and problem is solved. Both will expand as needed.

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

Infinite loop: after getting integer input you have to flush the input stream of the <Enter> key '\n'. Read this thread

int n;
cin >> n;
// flush input
cin.ignore(1000,'\n');

>>I figured hitting the 'x' button at the top right would be a good solution.
Well, that's a terrible solution. So is pressing Ctrl+C. Get the menu selection as a char instead of int so that it will accept 'q'.

char response[2];
cin >> response;
if( response[0] == 'q')
    return;
switch( response[0] )
{
   case '1': // blabla
}

>>Also, was the game too easy or too hard? Or just right?
It was just about right for me:) But I like easy games. Teen-agers who like to play elaborate games like World of Warcraft wouldn't like your game. But you are just starting out, so don't worry about that. Your games will become more difficult as you gain experience writing them.

restrictment commented: Very helpful +1
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Pretty simple, really

bool Class_name::find_a_record(ifstream& is, string name)
{
     Class_name n;
     is.seekg(0, ios::begin); // start at beginning of the file
     // while not end-of-file or error
     while( is.read( (char*)&n, sizeof(Class_name) )
     {
            if( name == n.name) // if found
            {
                  return true;
            }
     }
     return false;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

If you don't know what a function does then google for it and read all about it. For example, google for fstream and the first google link will tell you all about fstream. Open up that link and you will see all the fstream methods. Now do the same for isdigit (which returns 0 if the character is not a digit '0' - '9' or non-0 if it is.

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

Very nice game -- enjoyed playing it. I have two problems

  1. On the menu "What would you like to do?", it has 8 menu items. Your program needs to validate that I enter a number 1 to 8.
  2. There is no way to quit the game, except possibly finish the game. Enter q (for quit) and the program goes into an infinite loop.
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Because the name may contain one or more spaces you need to read the file one character at a time until the first digit is found, which will be the end of the name.

int i = 0;
char c;
while( infile.get(c) )
{
   if( isdigit(c) )
   {
      infile.unget(); // put the digit back onto the file
     break;
   }
   name[i++] = c;
}
name[i] = '\0'; // null terminate the string
infile >> planmin >> usedmin;
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Dave: Yes, I see you are correct. I wrote a short test program and had the compiler produce assembler instructions, which showed the same behavior as what you posted.

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

First you have to get a list of all the files in the folder ( see FindFirst() and FindNext() win32 api functions). Then for each of those call _stat() to get the file creation date and compare that with today's date. Finally, use remove() to delete the file.

Where should it be written: In the com component's startup code, probably in main(). If the com program is a windows service then you might want to put the code in another thread so that it can be put to sleep for 24 hours before running it again. This would assume the com component will stay in memory for a long long time, i.e. several days.

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

This demonstrates how to get a list of your computer's logical drive letters under the MS-Windows operating system.

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

Here is how to get a list of the drive letters

#include <windows.h>
#include <iostream>


int main()
{
    char buf[255];
    char cDrive;
    // get the drive letters as a set of strings
    int sz = GetLogicalDriveStrings(sizeof(buf), buf);
    if( sz > 0)
    {
        // buf now contains a list of all the drive letters.  Each drive letter is
        // terminated with '\0' and the last one is terminated by two consecutive '\0' bytes.
        char* p1 = buf;
        char* p2;
        while( *p1 != '\0' && (p2 = strchr(p1,'\0')) != NULL )
        {
            std::cout << p1 << "\n";
            p1 = p2+1;
        }
    }
    else
    {
        // Oops! something went wrong so display the error message
        DWORD dwError = GetLastError();
        FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, 0, dwError, 0, buf, sizeof(buf), 0);
        std::cout << buf << "\n";

    }
}

For the files that are in the drives you need to use FindFirstFile() and FindNextFile(). Google and you will find examples.

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

depends on the operating system.

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

Do you think I should quit Daniweb? I'm sure Bob would agree.

No -- just ignore him and maybe he will go away. Report harassing posts and he will probably get an infraction.

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

Here is the difference between Girlfriend 7.0 and Wife 1.0 operating systems (I've posted this before in geek's lounge)

O/T Dear Tech Support
Subject: Computer Hard and Software:
Dear Tech Support:
Last year I upgraded from Girlfriend 7.0 to Wife 1.0.
I soon noticed that the new program began unexpected child
processing that took up a lot of space and valuable resources.
In addition, Wife 1.0 installed itself into all other programs and
now monitors all other system>activity. Applications such as Beer
Night 10.3, Cricket 5.0, Hunting and Fishing 7.5, and Racing 3.6 no
longer run, crashing the system whenever selected.
I can't seem to keep Wife 1.0 in the background while attempting
to run my favorite applications. I'm thinking about going back to
Girlfriend 7.0, but the uninstall doesn't work on Wife 1.0. Please
help!
Thanks,
A Troubled User.
______________________________________
REPLY:
Dear Troubled User:
This is a very common problem that men complain about.
Many people upgrade from Girlfriend 7.0 to Wife 1.0, thinking that
it is just a Utilities and Entertainment program.
Wife 1.0 is an OPERATING SYSTEM and is designed by its Creator
to run EVERYTHING!!!
It is also impossible to delete Wife 1.0 and to return to Girlfriend
7.0. It is impossible to uninstall, or purge the program files from
the system once installed.
You cannot go back to …

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

Exactly, if the OP is satisfied that the problem has been resolved then there is no need for solvers to continue contributing to the thread. Marking the thread as solved means they can see from the forum page that the OP no longer needs help.

Although technically you are correct, sometimes it doesn't work like that. I've seen discussions continue even after the thread has been marked solved. And there is no rule to prevent it, for good reason. The op may be satisfied with the result but other contributors may want further discussions.

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

>>However, some testing suggests that double still performs better! This is unexpected.

Yup. floats are always converted to doubles when used as function parameters. Other factors may influence it too, such as the math coprocessor on your computer.

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

After calling the first function you have to clear the stream's eof() error bit. input.clear(); should fix the problem.

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

I think whats more important is what the safer way.

And what do you consider "the safer way" ?

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

line 22: >> scanf("Selection: %i\n", o);

You can't combine scanf() and printf() like that, and the parameter must be a pointer to an integer

printf("Selction: ");
scanf("%i", &o);
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I assume you did not post all the code in those two function. If you are getting just some random values then you are probably using some uninitialized variables in those function. Post the entire program so that we can see what you are doing.

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

try this

In c++ I would use either <vector> or <list> c++ classes instead of creating your own linked list as you might do in C language.

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

>> lines 12 and 53: binfile.open ("data.dat", ios::in);

If this is a binary file then you need to open it in binary move binfile.open ("data.dat", ios::in | ios::binary); line 52: add binfile.clear() to clear all file errors before attempting to reuse the same fstream.

line 53: I think you have to open the file for in|out when attempting to use seekg().

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

First learn how to list all the files on one directory, then the rest should not be all that difficult. How to get the list of the files will depend on the operating system( *nix, MS-Windows, MAC, etc. etc). Most of them do it differently then the others.

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

>>As far as I know, the fastest way to initialize an array is to do so using a for loop...

For simple data types (char, int, etc) the fastest way to initialize an array to all 0s is to use memset(). If you want to initialize it to some other value then use a loop as you posted.

char array[255] = {0}; // initialize when declared

memset(array,0, sizeof(array));

>>Does anyone know if there is an equally fast or faster method of initializing a c++ array ?
There is no difference between a c++ array and a c array. They are the same thing.

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

I would start here:

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

>>hat should I do?help~~~~
Create the INSERT sql statement. For example: INSERT INTO table1(name) VALUES("data") If that doesn't make much sence to you then you probably need to study SQL language (tutorial here)

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

The problem is #define small char . You can't do this: int char , which is what you are doing then you say int small;

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

depends on the operating system. *nix use opendir() and readdir(). MS-Windows use FindFirstFile() and FindNextFile(). Don't know about other operating systems. google for those function names and you will find lots of information.

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

Use FILE* and associated functions in stdio.h then read the file. Exactly how to go about parsing the file will depend on the format of each line. You could make up your own format or use one that many other programs use, such as

name=ArjunRaja
password=1234
age=23

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

Thanks jbennet for the info. I downloaded Clonezilla iso and burned to disk. Created an image of my hard drive in a little over an hour.

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

The "upgrade" version of Win7 that I got has two ways to install

  1. New install -- Insert the Win7 disk in the dvd drive, reboot the computer so that it boots from the dvd drive, then win7 will reformat the entire hard drive and installs Win7 from scratch. I'm not sure if XP or Vista is required to have already been installed or not, and I'm not willing to spend 24 hours redoing my computer to find out.
  2. Upgrade. Start up Vista, insert the Win7 disk, then run the setup.exe program on the disk.
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

line 32 is a string in scientific notation. The value is just too small to be represented in normal double precision, so you have to display it in scientific notation, like this: printf("%e\n", array[n]); // Here it doesnot In the value 2.657374814e-012 the -012 tells you to move the decimal point 12 places to the left, which makes the number 0.00000000000265..., a very very tiny number.

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

use wcout

#include <iostream>
using namespace std;

int main()
{
	wchar_t buf[] = L"Hello World";

	wcout << buf << L"\n";
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Start your research by reading some of these google links