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

Do you mean the functions in time.h or ctime? Read these links

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

I'm from USA -- we don't play the game here, so I'll bet on England because I lived thee 3 years in 1980s when Iron Lady was PM.

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

bingo!

tomtetlaw commented: i wouldn't have noticed my mistake without AncientDragon :) +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

How does filesystem->FGets( handle ) allocate memory for the return string? Post that function please.

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

There are at least three ways to launch a process -- system(), ShellExecute() and CreteProcess(). Which one you want to use depends on how much control you want over the newly created process. google for those functions and you will see how to use them. CreateProcess() is the most complicated, but also gives you the most control.

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

My guess is the problem is in CTokenStream, but could be wrong. The problem could also be somewhere before that function is called, such as buffer overruns.

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

To fix the capitalization problem you should convert the entered string to all lower-case or all upper-case, or use a case-insensitive comparison function.

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

new the beginning a meant to say "#include iostream" and "#include cmath"

No -- the way he has it is correct. The name of standard c++ header files go in angle brackets as shown in the code he posted.

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

you can not put function calls in class declaration unless they are inside inline code. Move that srand() line to main()

int main()
{
   srand(time(0));
}

Depending on the compiler you are using you may have to typecase time() to unsigned int instead of time_t.

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

well while using strtok(), i used to face troubles like " unable to convert pointer to integer" or something like dat.

for ex,

int *i,*j;

i = strtok(Line,":");
j= strtok(null, ":");

then also it gave me errors.

strtok() returns a pointer to a char, not a pointer to an int -- it only works with strings, never integers.

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

what operating system?

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

Well, just replace the comma with a space. What kind of trouble did you have -- the code snippet I posted works very well. If you need the original string to do something else then you have to copy it into another buffer for strtok() to use because strtok() replaces the tokens with 0's. If your intention is to change the value of a certain column and write the new string into another file then maybe strtok() isn't the best solution afterall. You can do something similar with strchr()) to find the spaces in the string.

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

You could start here -- be prepared for a very long learning curve.

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

Depends. What operating system? For MS-Windows, do you want to use pure win32 api functions? If yes, here is a tutorial. But there are a lot easier ways to write gui programs nowdays. Two of them is CLR/C++ Windows Forms, and C# instead of C.

If you are thinking *nix, then look into low-level X11R6 (there are lots of books on that) or Motief. Again, C++ gives you more and easier options, sich as wxWidgets.

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

Your program should run ok on 64-bit computers even without recompiling it. The only reason I can think of to recompile that program is to take advantage of the additional memory that 64-bit machines can give it.

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

First check your computer to see if winsock2.h actually exists. If it does, then you probably need to make a change to the list of folders that the compiler uses. You will find that list in Tools or Options menu item. I don't have that compiler installed any more but you will find standard compiler search folders somewhere there.

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

Just call fgets() to read the first line before starting the loop on line 32.

I think this would be a lot easier if you used fgets() to read every line, then parse it by using strtok()

char buf[255];
fgets(buf, sizeof(buf), in); // just ignore the first line

while( fgets(buf,sizeof(buf),in) // read the rest of the file
{
   char* ptr = strtok(buf,",");
   int counter = 1;
   while( ptr != NULL && counter < 9)
   {
        ptr = strtok(NULL,",");
        counter++;
   }
   // got the 9th column, so do something with it

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

I don't know about you all, but I love pies and I love cakes. But put them together, and what do you get? A Cherpumple Pie Cake Yuuuuuuummmmmmm!;)

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

Too bad that tutorial doesn't have an index to make it easier to find something. It's huge and very tedious to search all of it just to find something.

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

Here are a couple suggestions that may or may not work for you.

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

You mean like this if (KeyStroke == 0 || KeyStroke == -32)

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

That situation really sucks :( I'd certainly ask your lecturer why he/she assigned a program that has to be written in CLR/C++ Windows Forms, CLR/C++ is not the same as standard c++ and would require a totally different and more advanced class.

For starters, you will want to read some of these links to find out how arrays work in CLR/C++. For example to declare an array it would be like this:

array<String^>^ Seats = gcnew array<String^> {"1A","1B","2A","2B",
                "4A","4B","4C","4D",
                "5A","5B","5C","5D",
                "6A","6B","6C","6D",
                "7A","7B","7C","7D"
            };
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

line 18 in Test.h does not declare an array, but only an uninitialized pointer to an array. Therefore line 30 in Array.cpp will crash because the array has no size. Instead of trying to use an array of std::strings, use a std::vector, e.g. std::vector<std::string> a; Then call vector's push_back() method to add a new string to the end of the array.

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

Closer look at this program and I see that it can be quite complicated for a new programmer. Unless you are using a textbook specifically about CLR/C++ you will have to do lots of research online, learning how to search through Windows::Forms and its controls.

I would be most surprised if this was an assignment for a first year c++ programming student. It has to be a Windows Forms class you are taking. Give yourself lots and lots of time to complete this assignment, doing only a small part at a time.

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

Start out by creating a CLR Windows Forms project. That will generate the basic
dialog box on which you can drag&drop controls, such as edit and list boxes. Once you have the dialog visually set up the way you want it you can double-click a control and the IDE will create a startup event handler function for you. Then all you have to do is add your code in those event handlers.

CLR/C++ is not the same as c++ and you will have to learn some additional statemeents about .NET.

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

It is for C++ Visual Basic 2008

There is no such thing as c++ VB 2008. C++ and VB are two different languages.

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

What kind of program are you supposed to write? Windows Forms? MFC? wxWindows? win32 api?

I assume by now you have been given enough instructions in class to complete this assignment. Or have you been sleeping in class?

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

There is no such thing as c++ 4.5

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

You mean what compilers?? If you want to use CLR/C++ then start with VC++ 2010 Express (free).

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

There are probably quite a few articles about drag-and-drop. Here is one you might find interesting, its a little old now but probably still relivant. It might be a lot easier if you used CLR/C++ or C# and .NET framework. I'm assuming Microsoft has made drag-and-drop programs easier to do with .NET.

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

What didn't work? The download? You can't unzip the file? Or the program? Did you compile the program? I created that project with vc++ 2010 Express.

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

Attached is an example that I whipped up for someone else not too long ago that shows how to have both a console and windows gui app in the same *.exe program. First, create a windows gui app, then a console app. Copy all the source files from the gui app into the console app project directory, then add the gui app files to the console app project. At the beginning of main() in the console app crete another thread and in that thread proc call WinMain() of the gui app.

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

GetCurrentThread() will return the HANDLE of the current thread, which you can pass to GetThreadId().

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

Unless your instructor required you to use Dev-C++, you should replace it with Code::Blocks because Dev-C++ has not been updated for quite a few years and contains a very old version of gcc compiler. Code::Blocks is also free and current.

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

>>would this make the program run

Don't know -- why don't you compile it yourself and find out if it works or not?

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

Do you mean thread ID or window id? All the windows in the same thread of the same thread ID, but each one has its own Window ID (or HWND handle).

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

Your compiler is correct -- look at the parameters to SetTime() and then look at the number of parameters main() is trying to pass to it. They ain't the same.

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

The PC will have to write the data to the file system because it can't be done from something connected to a serial port.

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

just add -lm on the same line as gcc, such as gcc -o new prog.c -lm

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

I don't think it really matters to the compiler which place you put the paths, or even if you put the same path in both places. Its just a matter of organization for you. I put project-specific paths in Additional Include Directories, and compiler-specific paths in C++ Directories.

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

Please read this thread

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

You have to use operating system specific api functions because c++ itself does not support the mouse. On MS-Windows I think you can also use pdcurses library or win32 api console functions. Don't know about *nix, except use curses library for mouse.

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

post the entire code

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

what did you enter for a and b, and what were the results?

mitrmkar commented: A good question +7
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

make sure to include math.h

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

Search www.amazon.com for mfc c++ books and pay close attention to when they were published, also check the reviews. Those published within the past two years should be ok.

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

The parameters to some functions are incorrect -- you have to pass a pointer to a pointer if you want a function to change the calling function's pointer. Example:

struct node* InsertAtEnd(struct node** head, int value) {  
   struct node* newnode = CreteNode();
   newnode->data = value;
   newnode->next = NULL;
   if( *head == NULL)
       *head = newnode;
   else
   {
        // locate list tail and insert newnode there
   }
   return newnode;  
}

int main()
{
    struct node* head = NULL;
     InsertAtEnd(&head,1);
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The loop for the cout statement is backwards for(i = 9; i >= 0; i--)

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

Re-read my comments. The statement about lines 5 and 27 is not related to the comment about input array.

Comments by other members in this thread are also valid, so the OP should read them all