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

I just compiled them on Ubuntu with Code::Blocks and did not get that error either. Maybe the problem is either in your makefile or something else that you did not post.

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

How are the functions in main() getting called? Pass them another parameter -- the HWND to the command history window.

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

I used vc++ 2010 express on Windows and did not have a problem compiling your header files. I also compiled it ok with Code::Blocks which uses MinGW (Windows port of g++)

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

I'm assuming this is a non-managed program, not Windows Forms which is managed cli/c++.

Why don't you call win32 api MessageBox(), which can be called from main().

main() can use the other windows controls providing it knows about the window's HWND handle.

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

what compiler are you using? AFAIK all c++ files are named either *.cpp or *.cc, depending on the compiler. g++ on *nix normally use *.cc.

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

Instead of having all those arrays it would be better if you created a structure or class to contain all the data for one line, then create a vector of those classes

#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <sstream>

struct item
{
   char s;
   int x;
   double y;
};
int main()
{

    std::vector<item> items;
    std::string line;
    std::ifstream myfile("textfile.txt");
    while( std::getline(myfile, line) )
    {
        item it;
        std::stringstream str;
        str << line;
        str >> it.s >> it.x >> it.y;
        items.push_back(it);
    }
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>"Board.C: In member function ‘void Board::input(bool)’:

Are you sure that is the correct filename? *.C programs are usually compiled as C, not C++.

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

Well, you can easily find that out for yourself. Just create an iterator and run through the vector to see if it was erased or not.

vector<card>::iterator it = cards.begin();
for(; it != cards.end(); it++)
{
   cout it->name << '\n';
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

When fopen() returns a NULL pointer it means that it can't find the file you want to open. Check your computer to see that the file is in the location you said it is in the program. line 142 ignores the filename that is passed to the function and just tries to open c:\stuff.txt.

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

Did you read thrught the thread here in the c++ forum about that topic? c++ standards only change once every 10 years or so, so if a book has been published within the past 10 years then it's not outdated.

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

You could sort the vector then repeated entries will be easy to find with minimum effort and time. Use an interator if you want to erase duplicates because erase() return the iterator to the next item following the one it erased.

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

line 157: variable temp is just an unallocated pointer. You have to allocate memory for it before it can be used. temp = malloc(sizeof(NODE)); add that between lines 156 and 157.

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

You want a code beautifier program.

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

If you just want to play games then get Wii or Xbox instead of PC. They're cheeper than PC and there are more games available for them.

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

>>I am running into some runtime issues with opening and procesing the file

What, speficially, are the problems you have? compiler errors? If yes, then post a few of them.

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

You are going to have to post the code you tried because we can't see your monitor.

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

If you want to do it using win32 api console functions then here is a thread you might be interested in reading.

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

That doesn't need a nested loop -- just a simple loop will be sufficient.

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

what opeating system? what compiler? GUI or console program?

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

What are they? Margarita drinks?? Horses (e.g. horse races)?

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

Told you so :)

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

It will not be a simple thing to do.

std::string word = "i want to go to line 2 and begin all over again.so line 2 is going to be replaced just like 3,4,5";
// search word for the first occurence of a digit
for(int i = 0; i < word.length(); i++)
{
   if( isdigit(word[i]) )
   {
        // found it, so do something with it
   }
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

YouTube lesson. To me he was a little rambling and didn't provide a technical reason why a formatted hard drive seems smaller than the manufacturer's stated size but he does explain in layman's terms.

Here's another explaination. According to that thread it all depends on how you want to count the size -- as someone else said it all depends of what "is" is.

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

First step is to check if the first character is a numeric digit or an alpha character. If its a digit then just subtract '0' to make it binary

char input[]= "4";
int x = input[0] - '0';

Or you can use atol() to convert a string of digits to binary

char input[] = "123";
int x = atol(input);

Many progrmmers prefer strtol() instead of atol() because it catches errors better.

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

The same thing happens to your hard drive, if you sum up the size of all the partitions on your hard drive(s) it will be somewhat less than the manufaturer's stated size. The reason is that the operating system requires some space to store the file allocation table and other information about the drive.

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

64 monitors :icon_eek:

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

The cast has nothing to do with the problem. Your code is the problem, since you were given foo() and can not change it. You will have to post the exact code if you expect to get any further help from anyone. Afterall, we can't see your computer's monitor.

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

>>PS: is %u Ok for printing out addresses
If you want to see the address in hex instead of decimal use %p

This example will show you how data is stored in memory

#include <iostream>

int main()
{
    int x = 123;
    char buf[sizeof(int)];
    *(int *)buf = x;
    for(int i = 0; i < sizeof(int); i++)
    {
        std::cout << (int)buf[i] << ' ';
    }
    std::cout << '\n';
}
myk45 commented: Thanks +1
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>if(f1.fail())
That should be if( !f1.is_open() ) to check if the file was opened or not. I've also seen if( !f1 )

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

No, don't work with "my" foo.

Again -- "don't work" means nothing to us. Is that what you tell your auto mechanic when you need your car fixed?

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

I agree with gerard -- if you program doesn't work then the problem is elsewhere.

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

>>At least where can I find useful information
MSDN is the best source for win32 api functions. I don't like OpenFile() because it only does binary reads/writes, but is useful to serialize MFC objects with CArchive MFC class. Otherwise I much prefer standard c++ fstream. Just because you are writing a Windows program doesn't mean you can't use standard C++ classes and STL containers.

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

what is foo() trying to do that that string? When you say "it doesn't work", what exactly do you mean by that?

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

No, but the program can ignore empry lines

int main()
{
    int count = 0;
    std::string line;
    std::ifstream in("textfile.txt");
    if(in.is_open())
    {
        while( getline(in, line) )
        {
            if( line.length() > 0)
            {
                cout << line << '\n';
                ++count;
            }
        }
    }
    cout << "# lines = " << count << '\n';
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>what is the maximum size length can be?
The maximum value of unsigned int -- see your compiler's limits.h for that value.

If you are reading the text file one line at a time, such as using getline(), then use std::string instead of char* so that you don't have to guess (possibly wrong) about the length of a line.

Jsplinter commented: thank you! +1
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Another way is to call _stat(), which will return the file size among other things.

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

You don't have to retype anything in order to post it here. using your IDE, just copy the code into the clipboard (almost all IDEs will let you do that) and paste it here into the editor between code tags. The code tags will preserve all the spacing you see in your IDE.

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

Welcome to DaniWeb -- I've had a lot of fun here myself from one old fart to another. I've also learned a lot of things from people with far less experience than I have -- just goes to show that you can learn something new every day no matter how much experience I had.

A word of caution -- don't get yourself overquaified for jobs that you want. Getting a Ph.D. is OK if you want to do research or teach, but not if you want to do grunt-work coding, be a team leader, or IT manager. In that case there will be a lot of doors slammed in your face with that Ph.D. because people won't even want to interview you.

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

You need to visit www.codeproject.com -- it has the largest repository of MFC and Windows code on the internet, along with tutorials and other articles. I know it contains buttons of various shapes as you described.

If you are writing MFC programs, then being a member of codeproject is an absolute necessity. I wouldn't have survived without it.

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

>>can't I just declare that the CHAR[25] = *CHAR; ?

No -- char str[25];

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

You need to post more of the code because the code you did NOT post is just as important to solving the problem as the code you did post.

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

When you instantiate a single instance of a c++ class the constructor is called, and that's where the class is initialized. The same thing happens when you create an array of c++ classes.

>>do I still have to have a constructor for the class?
Depends on the class, but in most cases you would create a constructor, and possibly more than one constructor, including the copy constructor. This is where you will initialize class data objects, such as initializing them to 0 or NULL.

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

Because with only one or two posts new members are so far down the list that they might be ranked #90,000 or something. They will be only interested in obtaining an answer to their posted question, not in any of the stats that appear in the user profile. And once they get that information we will probably never hear from them again.

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

See this old article -- scroll down to the section Converting Managed Strings to Character Arrays

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

>>you read your email on your netbook while lyimg in bed
You don't bother to proofread a post before or after posting it :)

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

>>3. Cross platform (I use OSX, windows, and a linux machine)
That pretty-much limits the IDEs that are available on all three platforms.

IMHO VC++ 2010 is the best IDE for MS-Windows, although Code::Blocks is ok too. Neither of them support multiple languages such as Java etc. But for C and C++ I don't think you will find a better IDE. And the VC++ 2010's debugger can't be beat.

>>2. Some UML capabilities (especially I would love a program that can take source code and turn it into UML diagrams)
That's not the job of a compiler and its IDEs. You can get other program to do that, and it doesn't need to be cross-platform capable.

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

You should note that String^ and std::string& are NOT the same thing. You can not mix the two (String is managed c++, std::string is unmanaged c++).

Also, strcpy() will not work with either String^ or std::string without some sort of conversion, such as using std::string's c_str() method.

Since you are writing managed c++ it might be better to change that class to use String^ instead of those character arrays as well as in all the functions.

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

Does that compiler have a limit on the length of a symbol? I recall very very old C compilers had a limit of 6 characters for symbol names (this was in the days before c++).

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

>>What do you think??
Nice to know stats for regular members, but probably not much value to new ones.

Updating my profile is worth 5 points??? All I have to do to get more Actrivity Points is to to do the edit profile screen, scroll down and click Save button. I did it twice without actually changing anything and got 10 activity points.