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

Hello Karinc and welcome to DaniWeb. Glad to see you aren't just lurking about any more. Very few people are born experts at anything but acquire that status through years of learning from others and many hours of practice. I've been at this for awhile now and still feel like a newbe sometimes.

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

>>When you install the August 2007 DirectX SDK, doesn't it make you put the files somewhere?
Only if you select "Save" from the download link., If you do then it doesn't matter where you save it.

If you look in the compiler's Options you should see this in the Include directory (see Post #2 above)
D:\Program Files\Microsoft DirectX SDK (August 2007)\Include

I installed the DirectX SDK some time ago and don't recall if the installed added that line to the compiler or if I added it manually. In any event check your compiler and add the location where you installed the DirectX SDK.

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

You can't do it directly from c++, but if you wrote that Delphi program you can change it to get update info from the c++ program. You can set up a communications link between two programs, sort of like client/server, where c++ sends data to Dephi and Delphi uses that to update its progress bar. You might also be able to do it by hacking the delphi program, but that requires a lot of expertise that I don't possess. I'm not a hacker :)

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

>>Ok. I deleted line 32, but by doing that the program does not allow me to actually enter a string
Yes it does -- that is what the getline() function does. getline() accepts all that characters you type up to the <Enter> key (newline character). You can alter that behavor, but for now just use the default.

>>Still I need to know how to use to .length() function and where it comes into play
Don't worry about that just yet. Get this part of the program working first. After you get it to compile AND WORK correctly, then go back and re-read the program requirements that you originally posted

Use length function to find the length of each string. Store lengths in int array.

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

It doesn't matter where you save the downloaded file from the Dark GDK download link -- you don't even have to save it but just run it when prompted to run or save.

That will save a file names "Dark GDK - 161107.exe". You have to execute that program, which will decompress all the files and install them in "\Program Files\The Game Creators\Dark GDK". My guess is that you did not run that program. After that is done your compiler should be set up to go. Just open the example program located at "\Program Files\The Game Creators\Dark GDK\Samples\Visual Studio 9" and see if you can compile one of them ok.

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

1) delete line 33, it is destroying the value you enter from line 32.

2) line 32: you should be using i counter, not N. getline(cin, A[i]); 3) line 40: you need another loop around that line to display all the lines, similar to the loop you put on line 29. And don't forget to change A[n] to use the loop counter

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

node *temp is declared local to the info function. You allocate memory with the new operator, and have some cin lines to enter information from the keyboard. Then the function ends without doing anything with temp, it just tosses all that into the bit bucket leaving the allocated memory somewhere that can no longer be accessed.

>>my main contains a crtdbg declartion; so it prevents memory leak.
No it doesn't. crtdbg does no such thing. Read this

>> i need to open the txt file containg info, then have the data in the file put into a linked list - which is double threaded
What ok, but your program doesn't do that.

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

Update: I just successfully compiled and ran the same program "Animation Showcase" without any problems at all. No compiler warnings or errors.

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

You probably need to follow the steps in these instructions for setting up the Windows SDK in VC++Epress 2005 - telling VC where to find the includes and libs and executables.

That's ok but he is not using that compiler. VC++ 2008 has all that fixed up. You don't have to do all that suff any more.

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

you will probably have to tell the compiler where you put all those files. Fire up the compiler, then select menu item Tools --> Options. Exand the Project and Solutions tab, then select VC++ Directories Change the list box Show Directories For in the right dialog box and add the paths in appropriate places.

I just finished installing Dark GDK, and the installation program added the paths in appropriate places as I described above. If yours didn't, then you did not install Dark GDK correctly.

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

The "form" you are talking about is probably your program's GUI window. I don't think you want to do that. Just start out by creating a standard console program. Your compiler's IDE will contain a text processor where you can type in your program. You could use Notepad, but then it's not as handy to use as the IDE that comes with your compiler.

For VC++ 2008 Express you can read the instructions here to get started. I don't know about Borland because I never used it.

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

With the example text you posted you don't have to worry about the punctuation -- just sort the lines normally and they will all come out ok std::sort( array.begin(), array.end()) will do the trick, unless of course you are required to write your own unique sort algorithm.

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

>> Should't the order be the oppisite.
No -- the statement is evaluated from the inside out.

Here is another example of that

int bar()
{
    return 10;
}

int foo(int n)
{
    return n* 10;
}

int main()
{
   if( foo( bar() ) )
   {


   }
   return 0;
}

In the main() above, first bar() is called, then passes the return value from bar() to function foo(), after foo() is run the if part of that statement is evaluated with the return value of foo().

Always evaluate from innermost statement outwards.

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

you could just use WinZip to compress them all into one file then unzip them on the target machine.

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

>>Um, alright - that wasn't exactly what i was looking for
Then you need to be more specific about what you want. I can't read your mind.

I never used DirectX or DarkX SDKs, so can't help you. What version of VC++ are you using and what version of Windows ?

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

>>int main(int argc,char*arg=3argv)

that is not valid way to declare main() because it can not have default parameter values int main(int argc,char* argv[]); >>ow should it do the while loop while( getline(infile, line) )

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

click the link I posted the scroll down to page to "CGI Tutorial". The way I did it several years ago was to write a c or c++ program then change the program name from *.exe to *.cgi.

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

to convert line to lower case transform(line.begin(),line.end(), tolower); To put the string in an array

vector<string> array;
...
array.push_back(line);
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

maybe you mean if( !(++a) ) , which increments the value of a then checks if the value of a is 0.

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

I love Dungeon & Dragons games, so I sometimes play online Dungeon Runner. It can be played for free, or if you contribute $5.00USD/month you get extra stuff and getter playing characters.

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

>>Could you explain the two string arrays further

You can't use the original string array to insert the spaces for a couple reasons

  • the array may not be large enough to hold the additional characters.
  • the array may be a literal and stored in read-only memory, any attempt to change it would probably crash the program.

So to overcome those problems create another string array that is large enough to hold all the characters in the first plus the additional characters you want to add. Making the second array too large is ok, but too small can be a disaster waiting to happen.

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

>>if(isdigit(line))
idigit takes a single character and you are sending the whole string. What you should do is this: if(isdigit(line[0])) Your work would go a lot faster when you learn to recognize how to correct your errors. Your compiler told you exactly what line number had the error and what the error was. All you had to do was correct it.

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

If the wireless device is running a version of MS-Windows such as Mobile 5.0 then the ESSID is stored in the registry on the wireless device. If you are trying to get the ESSID from a program running on the wireless device then just read the registry. Sorry, but I don't know how to do that from a program running on fedora *nix server. MS-Windows server would use a win32 api remote function call.

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

1) delete line 14 -- it is causing a huge memory leak.

2) line 22: Don't try to get fancy -- split that into two lines so make it easier to understand. Don't write programs in an attempt to impress anyone because you will probably fail.

3) a few seconds of googling would have given you the C course code for the algorithm.

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

naw -- it isn't necessary to clear the whole cotten picken screen. All you have to do is output '\r' to move the cursor back to the beginning of the line. This assumes you want to display the value at the beginning of the line. putting it somewhere else on the screen is a little tricker because you have to move the cursor to a specific location.

for(int count = 0; count < maxcount; ++count)
{
    cout << '\r' <<  count;
    Sleep(1000);
}

[edit]twomers beat me to it :) [/edit]

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

>>isDigit
misspelled, its isdigit()

>>i=atof(line);
atof() converts a string to float, not integer. what you want is atoi() or atol(), and takes a char*, not a std::string i = atol(line.c_str()); If there is only one digit then you don't need any conversion function i = line[0] - '0';

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

that should be fairly simple. First find the comma and back up one character. That is where you insert the space. Add another space immediately after the command, and a line feed one character beyone that. Do it with two string arrays -- the first is the original string and the second is the altered string.

I would write it for you, but I don't want to spoil all your fun :)

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

I think the election is already over. Unless all hell breaks out this year, we will have a President Clinton again in the WH.

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

Sorry about that, but yes, that is my problem.

If this is schoolwork then your teacher should tell you how to do it. Otherwise, its nearly impossible for a program to check a string and add spaces where necessary to make it understandable to a human reader. You need to get more information from whoever gave you the requirements for the program.

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

Need an example. you want to change "WethePeopleoftheUnitedStates" to this: "We the People of the United States" ? If the text is in a file then you will have to completly rewrite the file. First open the original file for reading, then another file for writing. In a loop read a line, modify it in memory as desired, then write the modified string to the output file.

Problem: how do you know where to add the spaces and new lines ?

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

winerys::info() contains a huge memory leak -- you allocate temp with new operator but never delete it before the function ends.

why is that constructor opening a file for reading then never reading anything ????

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

curis: it isn't necessary, or even desireable, for you to manually add the line numbers to the code you post. We have standard [code=c++] /* Your code goes here */ [/code] tags that will add the line numbers.


line 23: delete those question marks. Its obvious that you didn't compile that because those question marks would have cause error messages. And use >> operators, not << operator. Just one simple rule to remember: << is for cout and >> is for cin. So that line should read: cin >> n; line 28: wrong, wrong wrong. You can't use variable n as a loop counter because it contains the number of strings you want to enter. for(int i = 0; i < n; ++i)

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

Ok people -- stop arguing about something not relevant to the topic or helpful to the op.

>>that i can display it using outtextxy() ...is that possible
Yes -- as Salem and Duoas have already mentioned. Displaying the text from a file should not be difficult unless you want to do fancy things such as color coding, changing font sizes and paginating.

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

>>I know within the for-loop I should prompt to read the strings into the array. Not sure how to do this
Read my post again -- I already gave you a hint about how to do that.

Suggestion: don't attempt to write the entire program all in one sitting. do just a little at a time and it will be easier to write. Write some, compile and test. Only after that works the way you want it do you contintinue with the next part of the assignment.

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

Yes, I know how to do it. Read this. to get started.

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

line 23: endl is only for cout, not cin, so you can delete that part of that line.

move lines 22 and 23 up outside the loop (between lines 19 and 20. Then the loop beginning on line 20 will go from 0 to n.

between lines 24 and 25 call getline() to get the string which may or may not contain spaces something like this: getline(cin, a[n]);

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

you misspelled the filename. d:\study material\SEN\MyWork\EvevtHandler.h

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

line 15. Wong check. You need to check argc to see if it is > 1. Then move lines 11 and 12 inside that if statement, between lines 15 and 16.

line 18: EOF is an integer, not a char. So you need to redefine variable c as int, otherwise if you leave it along that loop will never stop.

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

Here are some other possible causes for that error number. One of the reasons is that your project is set up to use precompiled headers and the file "stdafx.h" is not present in the project. Solution is to turn off precompiled headers.

What compiler are you using? Do you have windows.h on your computer ? If not then you will have to download the huge Windows SDK.

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

create a structure that will keep track of the frequencies

class freq
{
public:
    freq() {value = quantity = 0;}

    int value;
    int quantity;
};

Then an array of those structures -- since you need two arrays with a total of 30 elements then you will need at most an array of 30 structures struct freq[30]; now just iterate through each array. For each element in the array search that array of structures. If the value is found then just increment quantity; If value was not found then just use the first unused element.

I'm not going to code this for you, but it should give you an idea of what your program needs to do.

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

an anti-spyware program doesn't do the same thing as an antivirus program. I run avast and SpywareBlaster, but that's not to say they are the best at what they do.

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

Is EventHandler.h is a file that you created? If it is then use Windows Explorer and check if the file exists ? Is it in the same folder as the other source files, such as try.cpp ? If all those are ok, then post the code for the file that gives you that error.

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

please post code. does your user login account have admin privaledges? Can you delete the files manually using Windows Explorer?

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

>>what class should I use to do this?
Its not a c++ class, just call standard C library functions rename() and remove()

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

Of course its possible, but I don't remember how to do it because that compiler you are using is about 20 years old (maybe more) and is only used nowdays as a toy for kids to play around with. Anyone who really wants to learn how to program would use one or more of the many free modern compilers available today. Afterall, you can't learn to drive your dad's car by first riding a horse.

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

The problem with the spaces is not in the code you posted but the way you are getting keyboard input. You need to post that part of the program.

The code you posted has a major flaw though. You don't want to check the entire size of the buffer szword but only the number of characters the player typed. In C that would be strlen(szword).

int len = strlen(szword);
for(ncaps = 1; ncaps < len; ncaps++)
    szword[ncaps] = tolower(szword[ncaps]);
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The main problem with that code is that mp3 files are binary files and attempting to read them as text files won't work. Here is a working program that is just plain-jane c++.

#include <windows.h>
#include <iostream>
#include <fstream>
#include <string>
using namespace std;

// ... blah, blah, more global variables...
OPENFILENAME ofn; // Common dialog box structure.
char szFile[260]; // Buffer for selected file name.
HWND hwnd; // Owner window.
HANDLE hf; // File handle.

// blah, blah, more funtions...
inline void OpenWindow()
{
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = hwnd;
ofn.lpstrFile = szFile;
ofn.nMaxFile = sizeof(szFile);
ofn.lpstrFilter = "Playlists: m3u.\0*.m3u\0Music Files :mp1, mp2, mp3, wav, ogg.\0*.mp1;*.mp2;*.mp3;*.wav;*.ogg\0";
ofn.nFilterIndex = 2;
ofn.lpstrFileTitle = NULL;
ofn.nMaxFileTitle = 0;
ofn.lpstrInitialDir = NULL;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;

// Display the Open dialog box. 
GetOpenFileName(&ofn);
//    hf = CreateFile(ofn.lpstrFile, GENERIC_READ, 0, (LPSECURITY_ATTRIBUTES) NULL,
//        OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, (HANDLE) NULL);
return;
}


inline void m3u_to_PlayList()
{
ifstream F;
char Line[260] = {0};
F.open(szFile, ios::binary);
if( F.is_open())
{
    while( F.read(Line, sizeof(Line)) ) // Load m3u data into the Playlist.
    { /* This loop should do something similar to printing the lines
       from the m3u file. I used a message box as an example. */


        sz = F.gcount(); // get number of characters read
        cout.write(Line,sz); // write data to the screen
    }
    F.close();
}

cout << "\n\nLoop done\n";
return;
}

int main()
{
    OpenWindow();
    m3u_to_PlayList();
    return 0;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>Declaring a container object using keyword static in the class declaration will declare a single copy of the container for all objects of that type
true

>> and only objects of that type, to use

No. static objects have the same scope as non-static, that is public, protected and private. And static objects are identical to globals with the class and access scope restrictions. A public static can be accessed anywhere in the program, but a private static can only be accessed by a member of that same class.

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

Also try MFC(Microsoft Foundation Classes). It is an encapsulation of Windows API. To make them work just compile, build and execute the ordinary way!. As easy as that(You can even skip compile:) ).

I agree MFC is pretty easy to use, but it isn't free. Neither VC++ 5.0 Express nor VC++ 8.0 Express supports it. If you want to use MFC then you have to buy the Stanrard or better versions for $$$$.

VC++ 6.0 should be scrapped for the newest Express version because of compatability problems.