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

You do NOT declare aTable -- aTable is a mistake. You need to correct the spelling.

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

Jim: Do NOT use ICODE or TXT tags -- do it exactly as I illustrated in my previous post. NO OTHER TAGS PERMITTED. I removed those two tags from your post.

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

Look at that first error message, then look at your program. Do you see aTable defined anywhere ? Answer: NO you will not. Well what do you think you need to do about it? Hint: Check spelling and capitalization.

You also need to include <iomanip> to get the setw function declared.

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

why don't you do this the easy way by using the ifstream >> operator to remove all white space between words with output the word just read with one space

string word;
while( infile >> word)
   outfile << word << " ";
SpS commented: plain and simple +4
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

moved. This is a C program, not C++. You could use a loop something like below which adds nodes for 'A' to 'Z'. Also not the change in the structure. It isn't necessary for letter to be an array.

struct node /* Declaration of structure "node" */ 
{ 
    char letter; 
    struct node *next ; 
}; 
struct node *tail = NULL;
int letter = 'A';
for(letter = 'A'; letter < 'Z'; letter++)
{
      new_ptr = malloc(sizeof(struct node)); 
      new_ptr->next = NULL; 
      new_ptr->letter = (char)letter; 
      if( start == NULL)
      {
          start = tail = new_ptr;
      }
     else
     {
          tail->next  = new_ptr; 
          tail = new_ptr;
      }
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Code tags:

[code=c++] // your code goes here

[/code]
I always manually type in the code tags you see above. I only takes a second or two to get great looking results.

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

line 47 is wrong. you should use current, not new_ptr

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

Another solution is to set a global (or class) flag that indicates whether the timer function should do anything. If the flag is TRUE then the timer function should just return without doing anything. otherwise if FALSE then do whatever it would normally do.

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

I think the ios::app is absolutely necessary in the output option, otherwise every new circle will overwrite the previous data (default file open mode is ios::trunc). ios::app has no meaning to an input file action, as AD said.
.

ios::app means

(append) Set the stream's position indicator to the end of the stream before each output operation.

With that flag it isn't possible to write a record in any random place in the file. The default is not ios::trunc -- you have to set that flag specifically if you want the file truncated each time it is open.

int main()
{
    string word;
    fstream out("myfile.dat",ios::out | ios::binary);
    out << "Hello World\r\n";
    out.close();
    out.clear();
    out.open("myfile.dat",ios::out | ios::binary);
    out << "Hello World\r\n";
    out.close();
    out.clear();
    out.open("myfile.dat",ios::in | ios::binary);
    while( out >> word)
        cout << word << "\n";
    return 0;
}
vmanes commented: I also was working under a couple false assumptions. Learned something today. +2
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You probably failed to create a new project. Select menu item File --> New Project, then select the Console Project icon then fill in the rest of the information. After that those buttons and menu items will be enabled.

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

>>Didn't work...
what didn't work. I can't help you if you don't post your most recent attempt. Just saying something didn't work does not help at all.

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

Welcome to DaniWeb

>>I don't want to get warning You The Mod's for wrong posting, too.(ATTN MOD's: If wrong Forum, please forgive me!).
We are not that unforgiving, and we rarly infract newcomers because we know you may be confused at first.

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

dbx files are Microsoft Outlook files. How do you want to access them -- via computer programming language such as C or C++ ? such as do you want to write a computer program that accesses those files ? Your answer to that question will determine where I should move this thread.

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

you mean [code=c++] // your code here

[/code]

The above code tags will add line numbers and colorize your code.

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

main.cpp line 54: ios::app is only for output files, not input, so you might as well remove that from the open statement.

The main reason your program doesn't work is because of the way you are writing out the records. So NOT use ios::app (append) in the open statement, and before writing seekp() to the correct location, very similar to how you did it in main.cpp line 64. Do the same thing at main.cpp line 39.

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

Using VC++ 2008 Express I created a CLI Windows project, added a multi-line text box control, then coded the below function. Note that this may or may not be the best way to do it, but it works. I selected *.sys files instead of *.txt, but all you have to do is change it however you want to.

private: System::Void Form1_Load(System::Object^  sender, System::EventArgs^  e) {
        String^ namelist;
        array<String^>^  fileEntries = Directory::GetFiles("d:\\", "*.sys");
        IEnumerator^ files = fileEntries->GetEnumerator();
        while ( files->MoveNext() )
        {
            String^ fileName = safe_cast<String^>(files->Current);
            //ProcessFile( fileName );
            namelist += fileName + "\r\n";
        }
        this->textBox1->Text = namelist;
    }
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Don't use printf() -- see vmanes suggestion and you won't have to calculate the spaces as I said before.

As for color -- depends on the compiler you are using. Ancient TurboC is somewhat easy to do. For modern compilers you have to use win32 api console functions.

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

>>For the price display, you must also setw( ) for the item names, like:
Actually, my preference would be to use printf() instead of cout because its a lot simplier to align the text without resorting to calculating the width. But this is c++ and c++ is sometimes clumsy IMO.

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

You can't make the test until after the matrix has been filled in. So move lines 20-23 down after line 25 and start a new set of nested loops.

And as I said before you can't make this test using rand() to populate the array as you are doing on line 17 because you will almost never get a symmetric matrix that way.

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

you might have to calculate the value you put in the setw function on each line. For example if you want 20 spaces after the menu item on the first line ( "burger" ) then you will want to put 23 spaces on the next line so that the prices lign up right (assuming you are using a fixed-width font for display. If you are using a variable-width font then there isn't much you can do about the alignment with plain c++ code).

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

you forgot to post the code you have written so far

[edit]Oops! you used wrong kind of tags which hid your code. [/edit]

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

>> would appreciate any help,thanks in advance
Post the code you have written so far. If all you have to do is display the reversed string on the screen then create a loop that starts at the end of the string and decrement the loop counter until it reaches 0, something like this. Use cout to display the character.

let counter = string length - 1
while counter >= 0
   display one character of the string
   decrement counter
end while
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

In DISPLAY CODE why do you insist on doing things the hard way (character by character)?

for(k=0; k<no; k++)
{
    cout << arr[k] << setw(20) <<  "<< price[k] << "\n";
}

In the second program where is variable j declared?
The loop on line 11 won't work because the value of i is incremented before he test is made. So if you enter "0011" on the first iteration the value of i will be incremented and then tested for 0011. You have to make the test immediately after the integer is entered.

int j = 0;
for(int i = 0; ; i++)
{
    cin>>a[i];
   if( a[i] == 11)
       break;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Populating the matrix with random numbers will almost never give you a semmatric matrix. In order to test your program you will have to hard-code the matrix with known values like this

You have to create two nested loops to test each value, like this:

for(int i = 0; i < MAXROW; ++i)
{
   for(int j = 0; i < MAXCOL; ++j)
    {
          // put test here
    }
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

One way is to stop the timer before the process starts then restart it after it finished

KillTimer(hWnd, uIDEvent); // stop the timer
// Do some processing here
SetTimer( hWnd, uIDEvent, uElapse, lpTimerFunc); // restart timer
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

From the hint of the name I think getordervalue is a class method, so you need to call it like this: order1 = carArray[0].getordervalue(); And make sure the capitalization is correct too.

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

Che Guevara So what's your problem with the man who's been dead since 1967? Apparently he's considered quite a hero today.

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

Learn to read MSDN and navigate the links it contains. You will find examples of all your questions here

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

Obama campaign HQ in Texas

You point? What's that picture have to do with anything?

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

See this thread. Looks like you have to define socklen_t yourself.

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

See the examples here

I thik you want this: (see the :: scope operator) this->textBox1->Text = Directory::GetFiles(files3,"*.txt");

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

The <map> class might be useful here to map strings and function pointers

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

Which, if I recall correctly, was exactly the point the newsliberals were making about Ronald Reagan during that period. Your point?

I don't recall that at all -- but might just be my bad memory :)

My point? I didn't bring Reagan into this discussion. IMO he was one of the best presidents we've had in my memory, even better than JFK, who is overrated as a President. Reagan made everyone feel good about themselves and their nation, and when that happens we have a great economy. From what I've seen I think Obama will have a similar affect on us.

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

I already posted examples of how to do it. The i loop increments the rows. The j loop you coded increments the columns. But you don't need the j loop because cin will do that for you.

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

char arr[20][50]; You declared it as a 2d array. cin will do the difficult part of filling in the 2nd dimension for you like you were attempting to do.

>>how is that a two D array itz just arr a 1D array
arr is still a 2d array. If you aren't still convinced then try out the code I posted and see for yourself how it works.

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

But those menu lists are strings. "Burger" is a string and "Patty" is another string. Treat them as you would any other string.

>>Anf its specified in the assing ment to input and store in a 2D array.
The suggestions I posted meet that requirement.

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

Are you using packetStream object in another thread? If yes, you need to sinchronize access to that vector between the two threads. One way to do it is to create a semiphore. MS-Windows has several other ways to sinchronize the objects too.

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

Why even use a J loop? If you want to enter strings then just do this:

for(i=0; i<no; i++)
    cin>>arr[i];

You won't get spaces in the above, so if you need the spaces too then use getline()

for(i=0; i<no; i++)
    cin.getline(arr[i], sizeof(arr[i]));
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

If you are running Vista then read this thread

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

I was under the impression that Ronald Reagan was as well; weren't there newsliberals continually asking him about his stance on 'Nuclear Armageddon'? I'd hardly say he was a bad president...

Most, if not all presidents like to be shown going to church and that isn't the problem. It doesn't bother me that a president has personal religious convictions, its just that Carter and Huckabee carry it too far. No one can serve to masters at the same time.

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

Since they are consequential numbers its pretty easy for format the filenames

#include <cstdio>
#include <iostream>
#include <fstream>
using namespace std;

const int MAXPATH = 255;

int main()
{
   int i;
   char filename[MAXPATH];
   for(i = 0; i < 58; ++i)
   {
       sprintf(filename,"%02d.txt", i+1);
        cout << filename << "\n";
       ifstream in(filename);
       // blabla
   }
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

See a video here (Scroll down the page to the video link) While you are at it you should read the other material presented there.

If you are looking for c++ books then just read the Read Me threads at the top of this board.

>>I want to create HGE based games or even some small system utilities for my Microcontroller project (academic).
That may not be possible with the Express edition because it is not a cross compiler.

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

search for "sort algorithms" and you will get a lot of help. There are a lot of algorithms, which one were you instructed to use ? The Bubble Sort is probably the easiest to code.

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

If buffer contains the binary representation of the long then you can just do a simple assignment. But you need to consider the Big/Little Endean problem if the data comes from another source such as across the internet. long x = *(long *)buffer; or use memcpy

long x;
memcpy(&x, buffer, sizeof(long));
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Why don't you ask the people at Dev-C++ ?

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

I read the manual. Go to www.microsoft.com and enter the function name in the search box. Follow the links and you eventually find an example program.

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

>>I wonder if this could be a right approach ?
It could be, but what you posted isn't because the code you posted doesn't fix a thing when UNICODE is enabled.

>>LPCWSTR berit = L"c:\\MyDirectory\\*.txt";
Why????? that variable is never used in your program. so you may as well delete it.

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

I said that I was using the scenario that you had billions of dollars becasue you could not have all the money in the world.

I, for one, wouldn't know what to do with all that money. I'd probably have to give it away similar to what Bill Gaates is doing -- he's going to give most of his billions away before he dies (or at least that's what he has said). Bill Gates and his wife have an foundation whose goal is to give away money.

Bill and Melinda Gates and Warren Buffett set our overarching priorities—such as improving health and reducing extreme poverty in the developing world and improving high school education in the U.S.—and they establish high-level goals for our grantmaking programs. Then our three program teams devise a strategy for meeting these goals.

Bill Gates isn't the first person to do that -- Rockerfeller Foundation was formed many years ago (in 1913) to do that also.

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

. I would buy a ticket to heaven by giving it all to the Catholic Church.

Don't you know you can't buy your way to heaven ?

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

Welcome to DaniWeb DJ. I'm sure you'll have lots of good stuff to contribute in many tech boards and Geek's Lounge.