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

Unless you are required to use pointers it might be easier to use strstr() to find the location of the word " to " (put a space before and a space after so that it doesn't pick up the word "too" or any other word that contains "to".

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

Every since I got a FF update yesterday (to 3.5.7) it seems to be crashing a lot. Anyone else experience this?

[edit]64-bit Windows 7[/edit]

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

>>you may need to set firefox as your default browser to open all your internet pages in this browser.

I am using Windows 7 and do not have that problem. IE7 is the default browser, but I use FF the most. While in FF I never see IE7 popups.

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

didnt get it

We are not a software house for providing free software. If you can't find the code via google then the next best thing is to write it yourself or pay someone lots and lots of money to write it for you. If that is what you want then start a new thread here

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

vowels are aeiou, all other alpha letters are constants
toupper() will tell you if the letter is upper case
tolower() tells you if the letter is lower case

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

This Q&Awill help you (first one at the top of the page)

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

This has nothing to do with Win32 console apis (!)

gui is not so important

It could be done as a console text-based program -- the original version of MS-Windows (version 1.0) was like that, as were all the programs of that era.

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

Create a new project then add the existing *.c or *.cpp file(s) to it. See if that new project compiles ok.

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

Try deleting all the compiler-generated files from your project directory and the exe too, then recompile. Also check if there is another instance already running of the program you are trying to compile. Do this by looking at Task Manager.

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

>>can I use strcmp?

There is no need to use strcmp(). You can compare two std::string objects by their == operator

std::string s1 = "Hello";
std::string s2 = "World";
if( s1 == s2 )
{
   // blabla
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

you have to ask for the ID before reading the file. You have the cart before the horse. Then you have to remove that cout line that displays the data and replace it with a check for the ID that the user entered against the ID that was just read from the file.

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

I already gave you the code in my previous post.

Ok, here is a better solution. It doesn't do everything you want but shows you how to read the file and split the lines up into individual fields.

#include <fstream>
#include <iostream>
#include <string>


using namespace std;

int main()
{
  ifstream in("textfile1.txt");
  int id;
  string name;
  string line;
  float value;

  if( in.is_open() )
  {
    // while not enf-of-file
    while( getline(in, line, ',') )
    {       
        id = atoi(line.c_str());
        getline(in, name, ',');
        getline(in, line, '\n');
        value = (float)atof(line.c_str());
        cout << id << " " << name << " " << value << "\n";
    }
  }
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Hi,
If you delete the backup partition and you need to reinstall Windows, you will then need to buy a new OS or computer so it is best left alone.

Not true. I lost my HD on my HP computer, called HP tech support and they mailed me a DVD that restores the os (Vista Home Prem) back to factory settings -- cost me $25.00 but it worked. I could have saved myself that money and made it myself when I first got the computer, but dummy me didn't do it. It also took me about 24 hours to completly reinstall Vista.

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

You can't just view one piece of data without reading the entire file.

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

You will have to read the file sequentially -- from start to finish -- until you find the line you want. Here is one solution to the problem, which may not actually work well if there are no spaces in each of the lines.

ifstream in("myfile.txt");
int id;
std::string name;
float amount;
char comma;
while( in >> id >> comma >> name >> comma >> amount )
{
    // do something
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

>>A better solution might be to create a buffer (just an array of bytes), fill the buffer then write the buffer

But that won't work for huge files.

Here is another solution

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

call seekp()

ifstream in("myfile.txt");
if(in.is_open())
{
    in.seekp(0,ios::end);
    size_t size = in.tellg();
    if( size == 0)
    {
         cout << "File is empty\n";
    }
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

If you are using MS-Windows then you could call win32 api function CopyFile() to copy the file then delete the original. Otherwise, just write your own copy function to copy the file.

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

You have to set the focus to edit1 before calling SetSel()

CEdit* pEdit = ((CEdit*)GetDlgItem(IDC_EDIT1));
pEdit->SetFocus();
pEdit->SetSel(0, -1); // select everything
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

What kind of a dll did you create? I have VC++ 6.0 w/SP3 on Windows 7 and created an MFC dll, using all the default settings, and VC++ 6.0 generated eight files, none of them empty. Perhaps you need to reinstall the compiler.

>>Documentation states that I need to copy certain files from the template project into my project
Which files? Do you have custom templates on your computer that either you or someone you work with have created? If yes, then you will probably have to get them from whoever created them.

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

lines 60 and 61: you don't need both of those lines -- delete one of the two.

line 67: you are mixing up files opened in text mode and files opened in binary mode. read() method is for binary mode, not text mode. If it is really a binary file then you need to add ios::binary flag in the open statement like this: file_in.open(file_in_name, ios::binary); line 76: you need to use the value returned by gcount() instead of just hard coding the number 16 because the last read may or may not be 16, and anything between the number of bytes actually read and 16 will just be garbage.

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

seek to end of file, then get the file pointer. If 0, its an empty file. How to do that depends on whether you want to use fstream or FILE.

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

>>while all those GNU/Linux OS which are safe and free of virus and on top of all that its free.

Wong. *nix is just as vulnerable as MS-Windows. The difference is that hackers target MS-Windows a lot more because it is a more popular operating system. *nix does have its small share of viruses.

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

What operating system and compiler? If you are using MS-Windows then you will have to use the win32 api console functions. Or you could use pdcurses library.

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

>>I searched but couldn't find any threads on the topic..

why would Dani want to create a forum for something that will not be used ???

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

I suppose first you will have to figure out how to translate the numerical format in edit box #1 into the format contained in edit box #2. I have no idea how you would do that.

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

Probably
1) get the text from box1 into a string object
2) get the text from box2 into another string object
3) search text from box2 to see if it contains the text in box1
4) if found, highlight the text in box2

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

just like you would use any other header file: #includle <limits.h>

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

limits.h contains the maximum and minimum values for integers.

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

I liked this answer.

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

variable int1 is an integer (4-bytes on a 32-bit compiler), not a char. So the fread() will just read garbage into it. Or you might change that line to this: while( fread( &int1, 1, sizeof(int1)) > 0 )

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

I've been trying to test your program, but so far it hasn't worked for me either. If you are trying to use keyboard hook then the first parameter to SetWindowsHookEx() must be WH_KEYBOARD. Even with that change the hook function is not being called when a key is pressed.

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

one problem: move line 6 to line 9 because variable ii has to be reset to 0 on each loop iteration.

As for the problem you reported: I don't see where that code is displaying anything on the screen. The problem is more than likely in other parts of your program.

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

Is that dll file *.c or *.cpp file? If it's *.cpp then the function prototype in your program should not use extern "C" because that changes the function name.

Silvershaft commented: Nice help thanks! +1
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Just call it exactly like you would any other function. All the functions contained in the standard C and C++ libraries are contained in DLLs -- there is nothing any different about how to call the function in your dll.

If you used __export in the DLL then you will need to use __import in the function prototype in your program.

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

Here are a few explanations . I think it was under the user's folder on XP.

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

That is correct, because static class functions are just like any other global function except for the class scope identifier.

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

If you linked your program with the *.lib file that is generated when you created the dll then all you have to do is run your program. MS-Windows loader will auto-load the dll.

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

Just as I suspected. Only static methods can be passed to that C function. Make the function error static and it will probably compile ok.

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

post code of the class and the method that is causing the problem.

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

>>Is this thread about the Unix timestamp 2038 bug when 32-bit integers run out of numbers.

Not exactly -- that problem is common in MS-Windows too. Microsoft compilers have fixed it by using a 64-bit integer for time_t (time64_t)

Programs that contain the first two problems in my original post should have been fixed long ago in 1999 or earlier. Nobody should be using two digit years any more, except for some very rare purposes, such as extracting the Fiscal Year for US government agencies.

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

An example you can see here occasionally a = c++ + ++c; The result of that expression is undefined because (most likely) it violates the rules you cited. Consequently the result store in a will be whatever the compiler writer decided it to be.

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

_T macro is defined in tchar.h -- used for UNICODE compiles. When compiling with _UNICODE the _T macro converts char* to wchar_t*. When NOT compiling for _UNICODE the _T macro does nothing.

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

Ctrl+Z is not the same as EOF.

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


This is completely wrong :

Agree

It should be this :

Nope, that's wrong too.


That fuinction requires three loops, as I previously explained.

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

I think the solution to your problem is found in this thread.

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

I tried wt u said, but only a line (vertically) was drawn :S
ANYWAY thanx alot 4 ur help.

Did you forget to print the '\n' at the end of each line?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
for (line=1;line<=s;line++)
{
	for (loop=1;loop<=s;loop++)
		cout<<" ";
	cin>>ch;
	cout<<endl;
}

The problem is cin. you should have used cout, not cin.

Note: that function is far from complete. Do it something like this:
1) draw the top line
2) draw the left and right sides
3) draw the bottom line

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

So what is wrong with the draw function?

Observation: delete those global variables, especially the ones that are used as loop counters. They should be declared inside the functions in which they are used.