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

Hello Casper. Glad to see you joined DaniWeb. I don't know diddly squat about PHP or web development, so you will rarely see me in any of those boards. But don't hesitate to help others when needed.

casper_wang commented: Thank you for the welcome +1
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Welcome to DaniWeb. Sorry to hear about all those problems. If you post questions/comments in one of the technical board I'm certain you can get pointers and a lot of help.

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

Most files that are opened for writing are opened for exclusive use -- that denys write access by other programs and processes, and sometimes denys read access too.

So in between the 1mins times can Program B copy its content and after copying delete all the content in AAA.txt?

No. Program A has the file open for writing, which will deny program B from opening it for write too so that it can delete the file contents.

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

>>I wonder if it is possible to call the function void OneFunction()

Don't know myself. Instead of asking us if it is possible, why don't you just try to do it yourself? If you did, what were the results?

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

The way I would do it is to create a string that contains the player ID that looks just like it is in the file

#include <string>
#include <sstream>
using namespace std:

int main()
{

   int PlayerID = 1;
   stringstream str;
   str << "[" << PlayerID << "]:
   string player;
   str >> player; // this is now "[1]"

Now all you have to do is write the code to read the file looking for the player string that was created in the above code. When it is found, you can easily process read all the information associated with that player.

Will I write the code for you? The answer is NO. But if you post the code you have tried then we will try to help you with it.

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

1) GetData() must be declare virtual in each class for that to work.

2) (arr.front())->GetData(); . Don't call the GetData() method like that because the front() item in the array will most likely not be the item that was most recently added. push_back() puts the item at the tail of the array, not at the front. An easier way to code it is to use the pointer that was allocated:

In the code below I changed ShowData() in the base class to be a pure virtual function which must be implemented by all the derived classes. That's how the last loop in main() is able to display the data regardless of what derived class is used.

class person
{
protected:
    int id;
    string name;

public:

    person() : id(0), name("")
    {
    }

    virtual void GetData()
    {
        cout << "ID:";
        cin >> id;
        cout << "Name:";
        cin >> name;
    }


    virtual void ShowData() = 0;
    void Show()
    {
        cout << "ID:" << id << "\nName" << name;
    }
};

class prof : public person
{
protected:
    int students;
    int years;

public:

    prof()
    {
        students = 0;
        years = 0;
    }

    virtual void GetData()
    {
        person::GetData();
        cout << "\nStudents No.:";
        cin >> students;
        cout << "\nYears No.:";
        cin >> years;
    }

    virtual void ShowData()
    {
        person::Show();
        cout << "\nStudents No.:" << students << "\nYears No.:" << years;
    }

};

class student : public person
{
protected:
    int AVGGrade;
    int year;
public:

    student()
    {
        AVGGrade = 1;
        year = 1;
    } …
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

1. Yes. just use standard stream file i/o to sequentially read the file one line at a time. Look for the tag name, when found look for the value on that line.

2. Yes. The programmer has to write the server program in such a way that it knows what to do the the information it gets from the client.

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

for real, man... me too!


by the way, have you met "TRIAD" ?

he's the original poster

:P

what do you mean? sorry.. my english isn't good, because it isn't my mother language..
but i'm trying to understand it..

Well Duuh! I didn't realize that was triadR, since it was in all caps I assumed it was an abbreviation that jephthah made up :)

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

what compiler and operating system are you using? The code I posted is just standard c++ stuff, nothing compiler specific about it. And do you want to do this in English or some other language?

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

Are you talking about the digits of a number stored as text? Like this:

#include <iostream>
#include <string>
#include <wchar.h>
#include <cstdlib>
using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
    std::wstring iobuf;
    cout << "Enter a number\n";
    getline(wcin,iobuf);
    wcout << iobuf << "\n";
    int n = _wtol(iobuf.c_str());
    cout << "n = " << n << "\n";
	return 0;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

TRIAD,
.

I hate it when people use acronyms that I don't know the meaning of.

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

I don't have a problem with gay marriage. I have heard many straight people say that gay marriage will destroy the concept of triditional marriage between a man and a woman. Nonsense. I've been married (to a woman) for 46 years and nothing gays do will diminish my marriage. Why is what gays do in the privacy of their homes any of my business? I know one gay couple here in St Louis who have been together mogonomously for 20+ years. What makes their devotion to each other any better or worse than mine ?

[satire]I heard someone say "Let them marry and be just as miserable as the rest of us!"[/satire]

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

what if I did something like this:

int theFunction()
{
    //Bla blah blah, code here.
    //More code.
    int EndMarker;
    return 0;
}

would the address of EndMarker not be essentially the end of theFunction? Excluding the return, of course.

No -- the address of EndMarker is not even within the address space of the function. Its address is on the stack and the function code resides in the code segment(s).

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

Since you did not mention it, I take it there is no way to do that?

I did mention it. If you want a YES or a NO, then the answer must be NO. If you think about it for a little while the sizeof is an operator, not a function, and is evaluated at compile time. And at compile time the final code for the target function hasn't even been generated. So how is the sizeof operator supposed to evaluate something that doesn't exist yet?

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

There is no portable way to do it because the number of bytes occupied by a function may vary by compiler and even within the same compiler from one compile to another. Most compilers will generate the assembly code for a program.

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

how in the world did you think you can stuff that structure into a short int ? I'd like to wear a size 32 pants too but my fat butt won't fit into it.

Perform the checksum calculation on the individual members of the structure.

Nick Evan commented: haha, nice explanation +6
jephthah commented: lol +4
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

how u wil separate sentence if there is
exclamation mark in it..
a sentence may or may not end with exclamation mark..
n further if a sentence ending with double quotes n also hv quotes within quotes..
n a sentence having abb. like Mr.

And run-on sentences that have no ending punctuation marks.

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

Which Borland compiler do you have? graphics.h and associated lib are not supported by modern 32-bit compilers, only very old MS-DOS compilers such as Turbo C and Turbo C++.

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

hey its easy try it.

read characters from file in a buffer until u encounter a dot(.) save that buffer which is your sentence.

What say...?

But what about other sentence separators such as ? and ! How about a sentence that spans lines.

In the case of the second sentence, it is not terminated by . but by quotes "

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

I have CodeBlocks but it won't compile anything -- produces this error:
mingw32-g++.exe: installation problem, cannot exec `cc1plus': No such file or directory

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

the function that would be helpful for you here, i think, is STRTOK

Nope -- just use fgets() as previously suggested. No need to read the file one character at a time just to find line terminators because that's doing it the hard way.

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

what compiler are you using? I used VC++ 2008 Express and could not duplicate your problem. The only problem I had with your code is that hinstDLL was undefined. I even added cout statement in MyClass constructor -- it displayed ok too.

The dll file you did not post was this:

BOOL APIENTRY DllMain( HMODULE hModule,
                       DWORD  ul_reason_for_call,
                       LPVOID lpReserved
					 )
{
	switch (ul_reason_for_call)
	{
	case DLL_PROCESS_ATTACH:
	case DLL_THREAD_ATTACH:
	case DLL_THREAD_DETACH:
	case DLL_PROCESS_DETACH:
		break;
	}
	return TRUE;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

My bet is that you still have not done the insert() function correctly. Here is what I used and it works ok

void insert( ListNodePtr *sPtr, char value )
{ 
   ListNodePtr newPtr;     
   ListNodePtr previousPtr; 
   ListNodePtr currentPtr;  

   newPtr = malloc( sizeof( ListNode ) );

   if ( newPtr != NULL ) { 
      newPtr->data = value; 
      newPtr->next = NULL; 
      newPtr->prev = NULL;

      previousPtr = NULL;
      currentPtr = *sPtr;

  
      while ( currentPtr != NULL && value > currentPtr->data ) { 
         previousPtr = currentPtr;          
         currentPtr = currentPtr->next; 
      } 

      
      if ( previousPtr == NULL ) { 
         newPtr->next = *sPtr;
         if(*sPtr != NULL)
             (*sPtr)->prev = newPtr;
         *sPtr = newPtr;
      } 
      else { 
          newPtr->prev = previousPtr;
         previousPtr->next = newPtr;
         newPtr->next = currentPtr;
      } 
   
   } 
   else {
      printf( "%c not inserted. No memory available.\n", value );
   } 

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

The main difference between a macro and a procedure is that in the macro the passage of parameters is possible and in the
procedure it is not

That isn't true of any major computer language that I know of. Procedures in every language can accept parameters. In assembly language you can store the parameters in registers, push them one the stack or some combination of the two before calling the procedure.

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

where did you put that PostMessage(). And why didn't you just use PostQuitMessage() as previously suggested?

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

Are you using the Borland graphics from graphics.h in Turbo C or Turbo C++ ? Yes, then I'm not supprised it doesn't work with modern high-powered graphics cards. Afterall, Turbo C is something like 20+ years old.

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

>>111 is checking weather it is a first node or not
Nope, that won't catch the problem. When *sPtr == NULL, then previousPtr will also be NULL at line 118, and consequently *sPtr is dereferenced (illegally) at line 120.

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

You have not type casted malloc.

In C, malloc() doesn't need to be typecase.

line 120 of your program: Need to test sPrev for NULL before using it because first time through it will be NULL.

if(*sPtr != NULL)
             (*sPtr)->prev = newPtr;
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

when the loop at line 196 finished the value of currentPtr is NULL, so the loop starting at line 209 can not execute.

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

In the event handler for the exit button send a WM_QUIT event message to the program's main thread. More information is discussed here.

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

I don't know about the registry but I have written Windows Services programs that access the file systems because when you install a service you have to give it a login account that it will log into when it starts. Most services run in an administrative account.

Wben you just set the registry like you did the program will run but it is not running under any user account so it doesn't have permissions to do anything in the file system.

VernonDozier commented: Helpful. +4
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The extern keyword is used to tell the compiler that a data object is declared in a different *.cpp or *.c file (code unit). Its required for data objects but optional for function declarations. For example, you have two *.cpp files named A.cpp and B.cpp. B.cpp has a global int that needs to be used in A.cpp.

// A.cpp
#include <iostream>
// other includes here
...
extern int hours; // this is declared globally in B.cpp

int foo()
{
     hours = 1;
}
// B.cpp
#include <iostream>
// other includes here
...
int hours; // here we declare the object WITHOUT extern
extern void foo(); // extern is optional on this line

int main()
{
    foo();
}
Alex Edwards commented: Thank you for the clarification. It was never really explained in this way. +1
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Hello World isn't displayed because nobody is logged in. And that's probably why the file doesn't get created too. try putting the *.exe in the AllUsers startup folder
C:\Documents and Settings\All Users\Start Menu\Programs\Startup

I think it will then get run after someone logges into the computer.

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

Hi
I want to tell one thing to daniweb
if i click mark as solved when my thread completed and it asked again mark as unsolved it's not good, disble Mark as unsolved please
and also after solved problem disble reply buttons also
Just It's my suggestion only

The "Mark Unsolved" button is there so that you can change your mind. There have been occasions when someone marked the thread solved then later found that it wasn't solved afterall. Yes, I know he could just start another thread but just continuing the original thread is a better solution for everyone.

And the reply button isn't disabled because there are occasions when the discussion continues even though the thread has been marked as solved. This is ok here at DaniWeb.

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

Yes -- google give lots of links.

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

tie a string around your finger. That works for me :)

How about Davy or Dani moving this to Geek's Lounge. This isn't an appropriate place for discussing trivia.

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

If the documentation for Open AL is too confusing for you, how in the world do you expect to ever use it?

ssharish2005 commented: hahah Good point - ssharish +2
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Code is compiling.

i m also given convert.h .....
plz check out....

What compiler are you using. Most c++ compilers issue error messages on lines like this: char buff[str.size()]; because the size of the character array must be a const value.

[edit]Oops! too late. :) [/edit]

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

If you have a standard C or C++ program you can use the atexit() function

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

Your program is a confusing mixture between C and C++. It contains duplicate #include statements and you are using both cout and printf(). It looks like you took someone's C program and attempting to make it your own c++ by just adding cout and leaving all the rest of the C code.

As Angi said, you are going to have to post something that will compile cleanly before asking any questions about runtime errors.

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

C and C++ tutorials are identical. There are, however, some ODBC c++ classes that you can download that will help you once you understand how ODBC works.

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

Have you tried USB Central ?

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

Without seeing the code you wrote, my guess is that you didn't include windows.h

#include <windows.h>
#include <myheader.h>
#include <sql.h>
#include<sqltypes.h>
#include<sqlext.h>


int main()
{
    SQLHANDLE hdlEnv;
    SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &hdlEnv); 

}

The trick is to code only a couple lines at a time then compile to see your errors. That makes the errors a lot easier to resolve.

IMO that is not a very good tutorial because it lacks a lot of stuff. Here is a better and more thorough tutorial.

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

Look for buffer overflow -- writing beyond the end of a buffer. Post the whole read thread because the problems isn't in the code snipped you posted.

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

put the writes in another thread.

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

Here is Microsoft's Scribble tutorial that was written for VC++ 6.0 compiler. I see its also available for CLR. What you describe that you want to do isn't very difficult to do with MFC, its just a matter of learning how to use VC++ IDE and add the standard MFC controls to a form. The graphics part is just drag-and-plop onto a form.

You should also bookmark (and join) www.codeproject.com because they have hundreds of code/examples/forums devoted to MFC and Microsoft computers.

It will take 3 months to a year to get pretty good at writing MFC programs and learning how to navigate around MSDN.

>> Where did you learn, Dragon-Man?
I started out with the tutorial I posted above then bought a couple books from my local book store.

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

You could just call the phone company and ask them. If its a legitimate number they will have to know the address. But you might need a court order to get it.

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

Hi,

this problem is solved..

The code which i used is as follows

//Add this header files
#include <iostream>
#include <fstream>
using namespace std;

ofstream ofExfile;
ofExfile.open("config.html",ios::out);

do{
        if(ofExfile.is_open())
        {
             ofExfile << lpBufferA;
         }
}while(cond);

ofExfile.Close();

I didn't get you.

The content what i read from InternetReadFile API were written into the file using same code what i mentioned in the last post.

If there is mistake in that code then pls tell what it is.

If required I can write whole function here.

The solution you posted was not a solution at all but some attempt to simplify the code for us. You should have stated that instead of calling it "a solution". AFAIK the last code you posted is probably correct

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

>>Make some square ones, and some banners and some skyscrapper banners.
You mean you want MORE advertising? Most people want less.

>>And create a link on the mainpage to the Daniweb button page
And what page would that be? What is a "button page" ? A link would explain alot.