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

_T is a macro that converts a quoted string leteral to wide character, such as wchar_t something[] = _T("Hello World"); Never heard of _RT macro, and its not defined in tchar.h, where _T is declared.

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

A program doesn't know how it was launched. Another program could have launched it by calling one of several C functions, such as CreateProcess(), system(), ShellExecute(), etc. Or it could be launched by some other non-C program using functions available to it for that purpose.

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

>>char date of birth[15]

There can not be spaces in the object names. One way to code it is to replace spaces with _ character char date_of_birth[15]

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

How many characters are on each of the lines in the file? Just 2 characters per line? That's all your program is reading. Post the first few lines of the text file so that we can see what's wrong with your program.

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

An array's size is only limited to the memory of the machine running the code.

It would be limited to the sizeof(std::size_t) See definition of the new operator

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

Your program is not related to del command, but permissions. Windows 7 doesn't all you to delete files from c:\windows and c:\Program Files folders for security reasons. That doesn't make del a deprecated command.

Working with a folder that you have created yourself and have permissions, to delete all the files in that folder and all sub-folders del /S /Q *.* Now if you want to also remove all the folders rmdir /Q /S <parent folder name> To get online help with these commands del /?

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

>>I wonder what version of Windows Microsoft depreciated del *.* from the terminal.

What makes you think it was depreciated? That command is still alive and well in Windows 7.

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

If you use fgets() you will also have to remove the terminating '\n' that fgets() will add to the end of the string, assuming there was enough room in the buffer to hold it.

fgets(name[i],sizeof(name[i]),stdin);
if( name[i][strlen(name[i])] == '\n')
  name[i][strlen(name[i])] = '\0';

or you can do it like this

char* ptr;
fgets(name[i],sizeof(name[i]),stdin);
if( (ptr = strchr(name[i],'\n\)) != NULL)
   *ptr = '\0';
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

lines 16 and 18 are wrong, you are passing a pointer to a single character not the whole string. Here's how to code it scanf ("%s", name[i]);

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

what are the errors? Post a few of them.

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

my previous example is the same as yours one...... - but problem isn't in this point - the problem is in fact that the compiler demands main() func for win23 console program when it should use WinMain() func. instead of main()

There is probably some other changes you have to make for win32 projects. I just created a win32 application project and it compiled and ran without error. You should do the same and check the project settings to see what other changes you might have to make in your program.

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

Yes, it does.
Actually if "Enable Microsoft Extensions" option is unchecked, then compiler will issue the message:

If you are compiling a Windows program, make sure you use the /Ze option!

So '-Ze' is a command line option for the compiler which means 'Enable Microsoft Extensions'. Anyways, I'm glad that the issue has been resolved.

I stand corrected, my apologies for the misinformation.

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

It does show the console window. It executes main(), not WinMain().

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

make the change I told you about and your problem will be resolved.

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

That means he is using a different compiler than you are. Just ignore it. Pelles C has no such option.

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

I installed your compiler and discovered the problem you are having. If you want to include windows.h in a console project you have to enable Microsoft Extensions. To to that select menu Project --> Project Options (at the bottom of the list) --> click the Compiler tab, then in the check boxes on the right select Enable Microsoft Extensions.

After doing that the program compiles and runs just as I posted previously without making any other changes to your source code.

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

Post the first two or three error messages.

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

you need to build a console project. Most likely your problem is that the program runs correctly but quickly removes the console window when its done and you can not see what happened. Programmers commonly put something at the end of the program to make it stop so that you can see it. Add getchar(); just after line 14 in main()

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

your program worked correctly for me using vc++ 2010 express. Below is the output I got on the console window. But you need to clear the input keyboard buffer after getchar() to remove the Enter key '\n'.

Please specify the number of the task.
 * You can choose on number from set = {1}
 * Specify "0" to exit
3

 Error(!) = Main menu does not support this command.
 Make sure that your task number is from menu set of commands and try again.

 Please specify the number of the task.
 * You can choose on number from set = {1}
 * Specify "0" to exit

 Please specify the number of the task.
 * You can choose on number from set = {1}
 * Specify "0" to exit
Press any key to continue . . .
vedro-compota commented: ++++ +3
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

So it seems like I should use a DLL, but how do I use a DLL?

Both static libraries and DLLs are used alike from the application program point of view. They both link to a *.lib file. To use a DLL all you have to do is copy it to one of the folders in the PATH environment variable or in the folder where the application *.exe is located.

If you do not have the *.lib file for a given DLL there is another way to link which does not require the *.lib file. Check out LoadLibrary() and GetProcAddress()

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

You can not hide the class declaration from the application program, but you can put the code that implement the class methods into a library so that the implementation code is hidden from the application program.

There are two kinds of libraries: static and dynamic. Static libraries have *.lib extension and are linked into the application program when the program is compiled and linked. This takes up the most disk space because each application program has a complete copy of the code it uses in the library.

Dynamic libraries on MS-Windows have *.DLL extension. When you compile a DLL the compiler will also generate a *.lib file that only contains the information compilers need to resolve function and data address while compiling the application program. There is only one copy of the code in memory regardless of how many application programs use it, so DLLs require the least amount of memory.

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

. And a lot of those ideas were stolen-- Bill Gates bought DOS really cheaply and Steve Jobs stole the mouse from Xerox (I think)..

Bill Gates got DOS from IBM so cheaply because IBM didn't know what to do with it and didn't really want it. So yea, you buy something at a huge price that hasn't been developed yet. That's not stealing -- its just good business.

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

Make sure the denominator in that equation is not 0. Print out the value of the variables so that you can verify them.

Also, get rid of those gets() calls such as on line 36 because they can let you enter more characters than the array can hold; the extra characters will be written to some unknown memory location and possibly crash the program. Replace gets() with getline() since you are writing c++ program.

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

>> why they needed to make 2 types of strings, char string and w_char string?

Because there are languages other than English. The alphabet in some of those languages, such as Chinese, can not be represented by one-byte char variable.

There are two versions of all, or most, win32 api functions, one for standard char* and the other for wchar_t*. Microsoft VC++ compilers since version 2005 default string to wchar_t* (UNICODE), and you have the option to change the compiler to use char* instead. If you want to use standard char* strings then just disable the UNICODE feature.

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

If you have to search the entire hard drive then the program will miss some of them because it will take a lot more than than 1 minute to do the searches.

Look up (e.g. google) low FindFirstFile() and FindNextFile() work and you will find out how you can use them in your program.

Because the above will be too slow for your purposes another option is to let MS-Windows notify your program when files change within a folder. Read this link to see if it will help you.

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

You can get a list of all the files/folders in a folder by first calling FindFirstFile() then call FindNextFile() until it returns no more files. Both functions returns a structure that contains the timestamp that your program will need to check. The problem is that your program may not be able to detect files that are newer than 1 minute, but you'll just have to run the program to find out.

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

But that's like saying you can only use the tools that were available 2,000 years ago when Jesus walked the earth to do today's work. Assembly may be the father of all computer languages but sure isn't the best one, or even the most efficient one to use today.

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

The head node itself appears to be uninitialized, except for the next pointer. Try changing the insert() method so that if head == NULL its set to current instead of allocating another new node.

void BulletList::insert(int posx, int posy)
{
    node* current = new node;
   (*current).next = NULL;
    if(head==NULL)
    {
       head = current;        //Head ska väl egentligen inte fyllas, lös detta med arv?

        (*head).next = NULL;     //Överväg att head inte kan ha y och x
        std::cout<<"Head next har något att peka på\n";
        //current = new node;
        (*current).x = posx;
        (*current).y = posy;
        (*current).travled=0;
        std::cout<<"Head ska få något att peka på\n";
        (*current).next = NULL;
    }
    else
    {
        node* previous;
        previous = head;            //Sista kan max vara den som head.next pekare på om head är fylld
        while((*previous).next !=NULL)          //Hitta sista elemtnet(det går inte att komma åt det snabbt
            previous = (*previous).next;
        //current = new node;                     //Skapar en ny node
        (*current).x = posx;
        (*current).y = posy;
        (*current).travled = 0;
        (*current).next = NULL;
        (*previous).next = current;                //Sista elemnetet pekar på det nya, skulle inte behövas om while(previous != NULL
    }
}
Epicurus commented: Identifies the problem and provides a solution. Great stuff! +1
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Also once you are in the work force you will start learning other languages as the need arises. College is not the end of your learning experience, but only the beginning.

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

C, C++, php, java, C#, and SQL are probably the most important ones. A great deal will depend on the kind of programming you want to do.

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

>>store_x_postions[ size] = random_x_pos;

Above is incorrect -- must be (size-1) so that when size == 1 then the correct index value is 0, not 1.

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

>>char reg_confirm[256];

>>reg_confirm = (char*) malloc (sizeof(char)*llSize);

Its not possible to call malloc to allocate memory for reg_confirm since reg_confirm is not a pointer. Your compiler should have produced either an error or a warning about that.

>>if (reg_confirm == NULL)
reg_confirm will never ever be NULL because it is not a pointer.

>>if (reg_confirm == "0")
You can't compare two character arrays like that. You have to call strcmp(), like this: if( strcmp(reg_confirm,"0") == 0)

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

First, if you want a 6-digit password then the variable must be declared as 7 characters to allow room for the null-terminator that cin will add.

There are several ways to do this (and more efficient ones too), here is one of them.

bool flag = false;
for(i = 0; i < 6; i++)
{
  if( !idigit(password[i]) )
  {
    cout << "Wrong password\n";
    flag = true;
    break;
  }
}
if( flag)
{
  // go back and ask for password again
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Do you want your program to do other things in the meantime? If you do, then put the alert messages in another thread, but your compiler may not support multi-threaded programs. So an alternative might be to use a loop

time_t t1, t2; // time variables
double dif;
t1 = time(0); // get current time
while(true)
{
   t2 = time(0);
   dif = diftime(t2,t1);
   if( dif >= (double)(15 * 60) ) // if 15 minutes expired
   {
      // display alert message
      //
      // reset timer
      t1 = t2;
   }
   // do other stuff here
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

If all you want is a pretty windows to show Thanks then just call MessageBox() from your console program. You don't need WinMain() to do that.

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

Use one of the many libraries available for *nix. Here is a good start

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

All standard C and C++ programs are the same regardless of what platform they are compiled for. That means all of them have an int main() function. All (or most) introduction to C programming books will be useful for either MS-Windows or *nix machines/compilers. You won't notice a difference between the two operating systems until you start more advanced programming topics, like sockets and creating GUI windows. But even then there are other libraries available that make those topics portable between os.

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

It's in System.Threading namespace -- link here

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

delete line 17 because the memory allocation is not necessary. strstr() returns the pointer that you want to use.

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

It worked ok for me with Chrome on 64-bit Windows 7

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

Code::Blocks normally puts all *.h and *.cpp files in the same folder as the project itself. If you move those files somewhere else you will have to tell CB where to find them.

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

When you create a new project with VC++ 2010 you have the option to create standard C++ or CLR/C++ (M$ doesn't call it "managed" any more, but CLR). See attached screen shot. With CLR/C++ you can call most, if not all, the same functions that can be called by C#.

I have not done extensive CLR/C++ programming either, just enough to get dangerous.

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

If you are trying to do console programming then you should be using the MS-Windows Console Functions. Moving the mouse pointer to some screen location will not allow you to start typing at that location, you have to move the cursor

Example console program

#include <iostream>
#include <Windows.h>

using std::cout;

int main()
{
    HANDLE StdOut = GetStdHandle(STD_OUTPUT_HANDLE);
       
    COORD c = {5,10};
    SetConsoleCursorPosition(StdOut,c);
    cout << "Hello World\n";
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

They are now called "Today's Posts" and "unanswered threads" the links on that purple ribbon at the bottom of the screen (it may be somewhere else when looking at DaniWeb on a tablet)

jbennet commented: cheers +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

look at the class at the top of your file. It says on line 40 that the function doesn't return anything because it is a void function. All that function does is call cin to get something from the keyboard.

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

line 209: getmodeno() is a void function so it can not be used as a parameter to strcmpi()

I am getting the impression that you did not write the code you posted, but just pasted it into your program. You need to look at the error message, then look at the line that the error message occurred. Most of the time the compiler will tell you what is wrong.

The next error, line 212, is actually caused by the semicolon on at the end of the if statement on line 208.

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

I see a mod has fixed up the code tags for you.

Line 204: see that semicolon at the end of that if statement? Delete the semicolon.

line 208: The typecast is incorrect. It should be char* not char

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

The error messages give you the line number on which the error occurs. I'm not going to count the lines in the code you posted, so I won't bother helping you any more than that.

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

USA has had its share of such problems since 1960 (LA bombings), and how about those car burnings in France about a year or so ago. Nigeria is more noted for its spam and scams then as a terrorist nation.

susheelsundar commented: You are way right sir. i was about to say that Nigeria is a heaven for criminals +0