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

>>Code::Blocks, like Dev-C++, targets MinGW and MinGW's current version of gcc is still somewhat out of date.

CB current version is 10.5 and is distributed with gcc version 4.4.1 copyright 2009. Is that not the same as current version of MinGW without CB? I don't want to install it just to find out.

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

Yes, really.

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

I don't know whether the IDE is buggy or not, but it is distributed with an outdated version of MinGW compiler and has a lousy debugger, not very programmer-friendly. Since its no longer being updated, such as with a current version of MinGW, programmers should stop using it and get Code::Blocks instead. CB is not only a nicer IDE, but it has a decent debugger and is distributed with current version of MinGW.

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

The maximum depends on the version of MS-Windows you are running. The maximum under MS-DOS was (is) 126 characters (maybe less depending on which version). I don't know the maximum for *nix, but its not the same.

On computers running Microsoft Windows XP or later, the maximum length of the string that you can use at the command prompt is 8191 characters. On computers running Microsoft Windows 2000 or Windows NT 4.0, the maximum length of the string that you can use at the command prompt is 2047 characters.

This limitation applies to the command line, individual environment variables (such as the PATH variable) that are inherited by other processes, and all environment variable expansions. If you use Command Prompt to run batch files, this limitation also applies to batch file processing.

link here

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

What??? PlaySound() is win32 api function. Did you even try it? If you did, then post the code you tried. Also tell us what compiler you are using.

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

I just told you. Before a function is called the program pushes the return address onto the stack, which is 8 bytes. Then it pushes each of the parameters. The ebp register contains the stack address of where the return address was stored. So to get to the first byte of the parameter it has to add 8 to the ebp register.

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

I always tend to open far too many tabs, and that's why I use Chrome. I love Firefox more, but when you open like 50 tabs (yeah, I hate closing tabs), it starts getting too slow for my taste (I once checked when it had 27 tabs open and it was using 3 GB of RAM and 50-99% of my CPU, it's not always like that of course, but you get the point).

LOL You need to start closing tabs when no longer needed!

Because of many Chrome lovers here I've switched from IE8/9 to Chrome and am learning to like it.

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

what compiler are you using? what operating system? what is VBO?

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

The function return address is in the first 8 bytes. The 8 is the offset into the stack pointer whose address is in ebp register.

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

Here is how to convert a digit in the string to an integer. Just subtract '0' from the digit to get the int value. Now put that in a loop to assign each character of the string into a matrix.

char str[] = "1010101";
int digit0 = str[0] - '0';
int digit1 = str[1] - '0';

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

ArtifiocialPerson clone(pseudorandom21)

Not funny, and tasteless.

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

Reads like an episode of Candid Camera :)

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

I would call fgets() instead of scanf() to read the entire file into a character array so that they can be rearranged or displayed (printed) however you wish.

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

Welcome Kerry. What does a PR man do anyway?

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

>>123456789123456789123456789123456789

Does the file actually look like that -- just a bunch of numbers with no separation between them?

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

The world already ended -- didn't you get the memo???

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

Ancient Dragon> char names[1024][40]; This allocates memory for 1024 names, each name can be up to 40 characters. That should be more than enough for your program.

OP explained already that s[he] did not wanted to do it as such.

Oh really??? Where was that mentioned?

For now i wish to use two tables instead of a two dimensional table.

You must have misunderstood that statement. By two tables he meant names[] and rates[].

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

I agree with Narue -- VS is my favorite too, especially because of its debugging capability. But 2010 is terribly slow starting up. I recall that VC++ 5.0 had a similar problem that M$ corrected in VC++ 6.0. Hopefully they will do the same with 2010.

On the rare occasions that I boot into Ubuntu and compile there, my favorite is Code::Blocks. Before that it was vi.

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

for line 13 your compiler is correct. names is an array of 1024 pointers, which are unallocated, meaning they point to no memory. You will have to allocate memory for them before they can be used. An easier way to do this for your program is to just hardcode the memory on line 7 char names[1024][40]; This allocates memory for 1024 names, each name can be up to 40 characters. That should be more than enough for your program.

Then on line 10 you have to index into names array using the loop counter, fscanf(file,"%s", names[i]); Now line 15 is something like line 10. On line 7 remove the * so that it allocates 20 floats, not 20 pointers. Then on line 15 do this: fscanf(file,"%f", &rates[i]);

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

As for punishment that could be a fine or prison term, but then how long is a piece of string.

My guess is that Mr. X is already in prison so he probably could care less about the laws of any country. Some prisons in USA are nothing more than country clubs.

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

That's called burnout. Take a vacation from programming for awhile to regain your enthusiasm. It happens to everyone on occasion.

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

If that last line is executed instead of any of those if statements then the line 6 is the obvious problem. have you checked the value of lparam and lparam & 0x80000000 ? And why don't you just simplify that line by using 0x80000000 instead of 1 << 31 ? The compiler could care less one way or the other but it would help you and others to know that mask you are trying to use.

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

not very responsive -- I could not make it work very well. I'm on 64-bit Windows 7.

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

It looks like you are using vc++ 2010. Make sure program test is set as the startup project (right click test and select "set as startup project" in the dropdown menu.,

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

suggest reading some of these google links. Writing programs for smartphones requires a cross compiler so that you can do development work on a pc then transfer the program to the device. Microsoft VC++ 2010 Pro version is such a compiler (the Express edition does not support it). I think (but don't know for fact) that gnu compilers on *nix can also be used.

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

Post the code you compiled. Most likely you need to add something to the end of main() to keep the program open so that you can read what it wrote on the screen. There are several ways to do that, but the most common is to add cin.get() , like this:

#include <iostream>
using std::cin;
using std::cout;

int main()
{
   cout << "Hello World\n";
   cin.get();  // Wait for keyboard input
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

MFC and ATL are both pretty old libraries that wrap win32 api functions. Neither are recommended for new programs. In c++ use Windows Forms and .NET franework, or more commonly called CLR/C++. I wouldn't bother learning MFC or ATL until you work for a company that has existing code you need to maintain. There are a number of books on the market that explain them, and the learning curve is pretty steep. If you are using VC++ 6.0 -- stop right now because that compiler is very old now and not very compliant with c++ standards. It also knows nothing about .net. Uninstall that compiler and get vc++ 2010 (the Express edition is free, but does not support either MFC nor ATL).

COM is often used to transfer data between applications and client/server. There are other ways to do the same thing such as sockets. For in-depth description you will need to buy a book.

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

It would be in limits.h if there are any.

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

Do you use sockets to read from USB port???

Please see USB Design By Example

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

Welcome to DaniWeb Allyson. Please tell us a little more about yourself, such as where are you from and how old are you. If you are in college, where?

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

EOF is added by the compiler at the end of each file not by user ok sir. so dont b sad

Wrong. The compiler has nothing to do with EOF. The compiler only converts the program source code to binary so that the operating system can execute it, and does nothing to the contents of a file.

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

[Dumb Question]Ok, what are DaniWeb Community Events?[/Dumb Question] I don't have any listed in my control panel. The link that Kraai posted seem to be just a list of people's profiles.

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

>>is highly dangerous, because you are just pointing newNode->data to your data. Once you free data and decide to iterate through the list, an error will likely occur.

It's certainly true if the programmer doesn't know what the hell he/she is doing. It was assumed the calling function had already allocated memory for data. Another option would have been to add another parameter, such as size_t size and let the function allocate its own memory for the object.

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

Because of the exhaustive legal appeals necessary for death penalty cases, the state has to pay $300,000 for defense attorneys for indigent prisoners per case.

See -- that's the whole problem with our legal system. The death penalty is not the problem, our legal system is. People in the old West days (18th and 19th centuries) were hanged or shot by firing squad immediately after the first conviction; there were no appeals. Maybe we should return to those days.

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

Is that your control panel screen? I don't get that link on mine.

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

GetSystemTime() is an MS-Windows api function, not standard C or C++. If that is what you want to do then you don't need <ctime> header file.

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

I hope you are not a native English speaker :)

1. 0, I don't drink alcohol any more.

2. I have no clue what that question means.

3. Or this one either. "keep it up?" in USA usually refers to a man's penis.

4. Don't know about this one either.

MosaicFuneral commented: "keep it up" nice. +0
debasisdas commented: "keep it up" Melvin :) +0
T.Rex commented: Keep It up +0
happygeek commented: arf :) +0
jingda commented: Lol. I like your thrid answer +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Yes they work in c++ too. There is no standard c++ time class. Just include <ctime> instead of <time.h>

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

standard library time.h will do what you want. time() returns the current time in seconds since some pre-determined date (epoch), such as 1 Jan 1970. With that you can call localtime() or gmtime() to convert seconds into a structure that contains year, month, day, hour, and seconds.

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

Then you'd work for 0 pay and be a slave to your employer :) Here is an interesting wiki article about internships.

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

>>At one minute apiece, that's 180 man weeks

It will not take near that long to do it in c or c++. Maybe one second or less for each file. Reading PDF, OCR and DOC files could take a little longer because their contents are a lot more complicated than TXT files. But even so they can be processed in seconds or less. A lot will depend on what all has to be done with the files.

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

you can always draw it yourself however you like it, something like this one

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

See also this thread. You have several options -- just pick one and go with it.

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

And the problem with that is what again??? binary search will always be faster than linear search. See this link

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

What have you tried so far? Have you used google to see if you can get any tutorials? Like this one?

And please, stop using those html tags, they don't work here.

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

It's illegal here to have unpaid interns doing anything at all useful to the business.

What makes you think interns do anything useful :) college credit should IMO be considered pay.

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

Sorting and binary search will take nlogn + logn time. Instead you can simply run through the list and spit out anyone that satisfies the requirement-- this takes linear time.

Agree if the search is done only one time. But when multiple searches are needed, the data is only sorted once (the first time), and with a vector of thousands of rows the binary search would quickly become much more efficient than linear search.

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

Binary searches only work on sorted data. So your first job is to sort the vector by energy. That should be fairly trivial if you use std::sort() and write your own comparison function. After that you could use any binary search algorithm on the vector, treating the vector as a simple array of classes. I'm assuming the vector could contain duplicates, so once the first item is found your program will have to search forward sequentially until it finds the first class whose energy is larger than the user input. Assuming the vector is sorted in ascending order you just simply print all the items from that point to the beginning of the vector.

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

i really enjoyed this thread its so nice see people sharing funny pics of them i m also trying to share my pics but i think i don't know the correct way to do that. can anyone explain it please?
thanks
-:suha

First you have to save an electronic copy of the picture somewhere on your computer. In DaniWeb, hit the Use Advanced Editor button located below the Quick Entry window, scroll down a little and hit the "Manage Attachments" button. That window will give you a browse button where you can select the picture you want to attach to your post.