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

>>And where would I put it?
Anywhere you want to on your computer. The download *.zip file contains several directories -- one of them is win32. Inside that directory is a makefile for various MS-Windows and MS-DOS compilers. AFAIK Dev-C++ is not one of the supported compilers. If you want to use Dev-C++ IDE then you will have to create your own DLL or static library project for it, add all the *.c files in pdcurses directory as well as all the *.c files in win32 directory. I did this using VC++ 2010 Express and they compiled ok but I have not yet tested it.

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

Maybe you should be using PDCurses instead of NCurses

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

Your compiler is a 16-bit compiler that only runs under MS-DOS and knows nothing about long file names, such as names with spaces. It will be impossible that compiler to create a new directory that contains spaces like "Program Files" or names longer than 8 characters and 3 character extension.

Check your spelling -- if you are going to display something on the screen it should at least be spelled correctly.

jonsca commented: Good point. I had thought that about the prompt also. +6
royng commented: Good and detail solution +1
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Salary depends on where you live.

What a programmer does all day depends on the job. Is he the only programmer in the company? Or is he a member of a team ? Its my experience that the biggest part of the job is program maintenance -- fixing bugs and making improvements. Here are some interesting articles about programmer productivity.

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

Also make sure you compile your program for release mode, not debug.

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

>>char[] Customers::passName(Customers c){

It is customary to code that using *, not [], as shown in the previous ^^^ post.

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

Attached is a HelloWorld program I created. Unzip it on your computer then load the solution and try to compile/link it.

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

Please read this thread and see if it helps you.

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

Is this the first console program you have written since installing that compiler? Maybe you have a configuration problem.

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

google for "windows forms singleton" and you will find this thread

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

One way would be to use non-standard _kbhit() from conio.h

while( !_kbhit() )
{
  // do stuff here
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Did you code a main() function?

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

I can do graphics in Dev- C++. I am using Dev-C++. :).
Just follow the instructions carefully and do not forget to put linkers. You can't do a graphics by making a new source file. You need to do a new project to put linkers.

Yes, but you are not using the 16-bit functions that are in graphics.h that is supplied with Turbo C. I vaguely recall something that someone made a port of graphics.h for 32-bit MS-Windows compilers.

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

Are you working on *nix or MS-Windows? Both VC++ 2010 (as well as earlier version) and Code::Blocks come with excellent debuggers. g++ on *nix has gdb. I don't do a lot of coding on *nix but I suppose Emax and others also have debuggers.

You don't have to download anything, the debuggers are installed when you install the compilers and IDEs.

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

For each letter in the source string you have to check each character in the vowels or conconants string to see if the letter in the source string matches one of those.

// count vowels
times = 0;
for(; *str != '\0'; ++str)
{
   for(vowelsptr = vowels; *vowelsptr != '\0; vowelsptr++)
   {
      if( tolower(*str) == *vowelsptr )
      {
          ++times;
          brak;
      }
    }
}

Another, even simpler way to do it is to use strchr(), if you are allowed to use that function

times = 0;
for(; *str != '\0'; ++str)
{
   if( strchr(vowels,*str) != NULL)
       ++times;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

segment fault can be caused by lots of different things, which may or may not be related to malloc(). For example if you try to copy a string into a character array and the string has more characters than the array can hold.

char file_name[5];
strcpy(file_name,"Hello Here, how are you?"); // Seg fault here

or yuu call strlen() on an uninitiaized array

char file_name[5];
int len  = strlen(file_name); // seg fault here

>>it's just that I can't debug while I get "Segmentation fault"..
Sure you can -- the debugger will stop at the place that caused the seg fault. Put break point just before that line, when the debugger stops you can check the values of local variables.

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

Just heard about this topic on TV a couple minutes ago. They (whoever that is) has handed out the last remaining addresses under the current addressing scheme.

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

I'd replace that old compiler with a newer one, such as Code::Blocks or VC++ 2010 Express. Dev-C++ has not been supported or updated for many years now, and the distribution contains an old obsolete version of MinGW compiler.

Aside from that, the error you got was probably because that header file was not in the same directory as the rest of the source code files.

Attached is the project I created using VC++ 2010 Express. I deleted all the compiler-generated files to make the *.zip file smaller

lexusdominus commented: very informative and helpful +2
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You are going to have to learn how to use your compiler's debugger instead of asking us to be your debugger. If you're using *nix you have a program called dbg that will take the core file and tell you where the problem is. If you are in MS-Windows then use the compiler's debugger to single step each line of your program until you find out where and what the problem is.

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

>>header_name=(char *) malloc ((strlen(header_name)+1)*sizeof(char));

You are not thinking -- use your head for something other than a hat rack. variable header_name is nothing more than an uninitialized pointer which just points to some random location. It is not a null-terminated string, so why are you calling strlen() on it? That makes as much sense as trying to put a tire on the bumper of a car.

If you want that function to work you will have to rearrange its logic. The lines of the program have to be in the order that they are to be executed.

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

No, not really. We in the USA enjoy many more freedoms than say people in Cuba or China.

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

They might not like what the current government does, but looks to me like its a recipe for disaster. Egypt could wind up with something much worse than they have already.

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

Your compiler is right. So why don't you initialize the damned thing. Line 1 of the code snippet you posted won't worfk if header_name hasn't been initialized to something before that line is executed.

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

>>I can not see any right for any government to censur or cut off people from Internet

Govenments can do as they please, afterall it is the government that makes the rules. I don't like what some governments to either, but there is nothing I can do about it. I can only control my own destiny, not that of anyone else.

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

Agree, I think that problem has been reported before, not long after those two buttons were introduced. Once the up or down button has been pressed there is no way to cancel the vote, such as when you pressed the wrong button.

It's probably one of those things low on Dani's priority list.

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

Maybe he's thinking Java

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

MS-Windows only runs on x86 or Intel based computers. Therefore win32 and x86 are the same thing.

>> If I chose x64, it doesnt run an any computer that doesnt have a 64bit OS.. If I press x32, It doesnt run on a x64 computer

I use 64-bit Windows 7 and run a lot of 32-bit programs. VC++ 2010 Express is 32-bit and generates only 32-bit code. Works without a problem on my computer.

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

Yes, I agree with Sfuo -- you can add MS-Windows gui to a console application. Here's how to do it from the console program. What I did was create a win32 windows application then copied the *.cpp, *.h, *.rc and other resource files into the console project folder, then add all those files to the console project. I even left tWinMain() in tact, just as the VC++ 2010 Express IDE generated it. I changed nothing in the GUI program. Then I put the GUI startup into its own thread so that the GUI would run at the same time as the console program.

DWORD WINAPI ThreadProc(LPVOID lpParameter)
{

    HMODULE hInstance = GetModuleHandle( (char *)lpParameter);
    _tWinMain(hInstance,NULL,(char *)lpParameter,SW_SHOW);
    return 0;
}

int main(int argc, char* argv[])
{
    DWORD dwCounter = 0;
    DWORD dwThreadID = 0;
    HANDLE hThread =  CreateThread(NULL,0,ThreadProc,argv[0],0,&dwThreadID);
    while(true)
    {
        // your actual console program may not have to call WaitForSingleObject()
        // I just put it here so that I could easily see the console displaying
        // something while the gui is running.
        DWORD dwReturn = WaitForSingleObject(hThread,2000); // 2 second wait
        if( dwReturn == WAIT_OBJECT_0 )
            break;
        cout << "counter = " << dwCounter << '\n';
        ++dwCounter;
    }
    cout << "All done folks\n";
    cin.get();
    return 0;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>... Could VC++ just tell me?!?
I think it did -- you just were not listening.

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

line 40 is wrong -- as posted it is just a simple global function, which is unrelated to the Tree class. You need to add Treed:: before the function name, similar to what you did on line 29.

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

The main idea behind counting words (taking into consideration that they are separated by a ' '(space) or ','(comma) or '.'(Stop)) is by detecting these symbols & increment a counter every time these are encountered.
This should pretty much do it :)

Although you might be right about counting words -- you have solved the wrong problem. The op is trying to count letters (non-white-space), not words.

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

clock() is useless for his purpose. He needs a way to break out of input, such as gin.get(), after a certain time expires. There is no standard, or easy, way to do it. kumar may have to write his own custom keyboard input functions using os-specific api functions and threads.

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

You seem to have your head together and are doing the right things. Stay in school and get a bachelor's degree from a 4-year college or university. Programmers today are a dime a dozen and you need to make yourself stand out from the crowd. Getting a 4-year degree will help you do that.

What should you study? Depends on your interests, but most people limit their studies to just a couple languages or so. You know the old saying -- Jack of all trades, master of none. Don't put yourself in that situation.

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

Or just char szFileName[MAX_PATH] = {0}; . In that case memset() is not needed.

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

A tripple pointer can mean one of two things:
1. A pointer to a 2d array. In this case the 3d star is not used in the calculation

2. A 3d array -- each dimension is calculated like I mentioned previously.

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

The compiler must know one of the dimensions in order to calculate the location of any specific double value. If it was only given ** with no other information how could the compiler possibly calculate the location of a[2][5]? In order to calculate that location you have to know the number of doubles on each row of the array, if the array is declared a[10][10]; then the compiler calulates it something like this: a (start of the array) + 10*sizeof(double) (number of bytes to start of 2nd row) + 5*sizeof(double) (number of bytes from start of 2nd row to 5th element)

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

>> however there may be more helpful answer because linux is open source
That has nothing to do with it. A byte is a byte no matter what the operating system (although it is true that not all bytes are created equal -- they may have different number of bits).

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

Thanks for the clarification -- just goes to show how little I really know about it :)

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

It doesn't work because variable a is not a pointer, its an array. Try this int foo(double [][10] )

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

I don't see why that would not be possible, text is just a graphic like lines. There most likely are not any free tutorials that will show you how to do it. I would start out here and write some small programs that illustrate the concepts to myself.

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

Now that you have renamed yourself from Steve to NoChoice, I fail to see the problem you continue to pursue. It should now be a non-issue.

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

>>that bool takes only one bit -> but how am I going to make char from one bit
No, the bool data type takes a whole byte (or possibly int) because a byte is the smallest addressable object. If you are unsure about the size of something you can easily find out like this: cout << "sizeof(true) = " << sizeof(true) << '\n'; Are you asking how you can read all the RAM you have in memory? I know it can be done because antivirus scanners do it. Don't ask me how because I don't know.

As for converting numbers into something readable, I don't think that would be possible. All the bytes of RAM contain a numeric value between 0 and 255. How to interpret that data will be up to the program that wrote in those memory spots. External programs will have no clue about what the data means.

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

using vc++ 2010 there are a couple options
1. Create a win32, Win32 Project. That will generate a shell of a program in which you will have to code all the window stuff using pure win32 api graphics functions. Here is a tutorial to get you started with that. Be forwarned that you will have to write a lot of code just to do the simplest things.

2. Create a CLR Windows Forms Application. This is mostly visual drag-and-drop to design the visual forms the way you want them. Then to make a control such as a button do something all you have to do is double click the button and add the code you want in the function that the IDE will provide for you. This is called managed c++ and is a little different than standard c++. Here is a list of several tutorials.

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

It does work -- maybe you are just doing it wrong. Post the code that doesn't work right for you. If you want another function to allocate all that memory then you will have to pass it with three stars, not two

double** foo(double ***array) 
{

   return array;
}

int main()
{
   double** array;
   foo(&array);
}

or you can use the c++ reference operator instead of a third star

double** foo(double**& array) 
{

   return array;
}

int main()
{
   double** array;
   foo(array);
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>We can not use a double pointer(int **) for a two dimensional array, right
Wrong. Here is a brief example of how to allocate such a thing.

int main()
{
   const int numRows = 5;
   const int numColumns = 10;
   double** pointer = new double*[numRows];
   for(int i = 0; i < numRows; i++)
       pointer[i] = new double[numColumns];
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Read the entire file and extract the column(s) you need. I would use fgets() to read a line, then strtok() to split it into individual columns.

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

Run the program with your compiler's debugger and find out why *.c2 is not being created. Possibly the function is not even being called.

Since includes can be nested -- that is, one include file can contain other include files -- you will need the function that processes includes to be recursive. Afterall, there is no limit to how deeply includes can be made.

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

You will have to post the code for that function, but the error message means you can not do something like this

char* foo()
{
   char data[25] = "Hello World";
   return data; // error because data is a local variable
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

How to get a bad reputation fast. It should be the unalienable right of anyone to delete their profile whenever they see fit. And vcards are well out of order.

Just post in one of the Software Development forums and I'll be very glad to give you lots of bad rep points :) While you can't delete your profile you can edit it to remove everything. Just clikck the CONTROL PANEL link you see at the top of each DaniWeb page. There you will find other links that let you edit the information in your profile.