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

what compiler are you using?

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

DWORD as well as other win32 api functions are declared in windows.h, so just add that to the top of your program and it should compile

#include <windows.h>
// other code goes here
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Or Do You Mean Delete All The . And ; In The Code...

No.

also delete >>

void WriteMem(DWORD MemOffset, DWORD DataPtr, DWORD dataLen) {
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Well, if you are going to ignore what we tell you is wrong with your program then I am going to stop trying to help you. You didn't change a thing. :mad:

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

read this article if you don't mind spending a few days learning how to do Office Automation in C++. I understand its easier with .NET but I haven't tried it myself.

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

>>And How Can A Habbit On Capital Letters Give Me A Warning...

Don't try that with the code you attempt to compile -- your compiler will complain bitterly if you capitalize when you should not.

Capatalizing every word is annoying, not cute, and just shows lack of intelligence. If you are under age 10 then you should be reading commic books or out doors playing softball.


>>BTW Im English I Dont Use Those Words For Those Sigh's In English Here.
what do you call them?

>>But Now I Get 3 More Error's.....

post code and a few of the errrors you are getting

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

the ony thing i didnt understand was words...

period and semicolon

Is English your firse language, or a foreign language to you? If you took English in grade school (grades K - 8) your teacher probably introduced you to writing sentences, and you should have been taught what a period and semicolon look like. My 5-year-old grandaughter already knows that much:eek:

A period looks like these characters

...........

and a semicolon is this thing

;;;;;;;;;;;;;;;;;;;;;;;

now, just delete both those two characters from your original post and I said before.

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

Not to beat a dead horse, I just stumbled across this article The Development of the C Language by Dennis Ritchie at Bell Labs

More recent descendants of C proper include Concurrent C [Gehani 89], Objective C [Cox 86], C* [Thinking 90], and especially C++ [Stroustrup 86]. The language is also widely used as an intermediate representation (essentially, as a portable assembly language) for a wide variety of compilers, both for direct descendents like C++, and independent languages like Modula 3 [Nelson 91] and Eiffel [Meyer 88].

and from a paper written by Bjarne Stroustrup

2. C with classes
C++ evolved from earlier versions called C with classes. The work and experience with C with Classes from 1979 to 1983 determined the shape of C++.

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

Did you even bother to read my post? I told you how to correct those errors. Re-read and pay more attention this time.

when I posted >> I was quoting your code -- its not meant for you to add >> to your code and compile it.

>>When I Say Im New To C++ I Mean Im New

If you are that new then you are attempting to do something that is wayyyyy over your head. Buy an Introduction to C or C++ book and start studying from page 1. Jumping into the middle like that will do little more than confuse you.

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

>>.void WriteMem(DWORD MemOffset, DWORD DataPtr, DWORD dataLen) ;{

remove the period and the semicolon. neither belong there.

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

>>C99 is functionally superior to C++,

probably because c++ standards predate C99. It will probably catch up the next time it is updated. If it doesn't then it only means c++ is NO LONGER a subset of C -- they then become two distinctly different languages.

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

>>..: Its the ignorance of the youth that hurts the world :..

but its the spirit and enthusiasm of youth that keeps it going:)

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

>>Didnt mean to contradict u, jsut expressing the logical.

not a problem. Unlike some people I am wrong sometimes. If I were perfect then I would probably be ruler of this planet :cheesy:

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

since C existed long before C++, that makes C++ a superset. C++ intereted stuff from C, not the other way around. You inhereted certain features from your mother and dad, they didn't inherit them from you.

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

c++ has all those things too and that makes C++ a superset of C although there are a few things in C that are implemented slightly differently in C++. And noone implied that you can write a C front-end for C++, that implies c++ would be a subset of C, not the other way around.

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

redirecting cout to a file would solve nothing. maybe you can use an existing semaphore instead of creating yet another one.

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

Only one object and one thread can write to a file at one time. The reason should be obvious -- if two threads attempt to write to the file at the same time the result will be an unpredictible mixture of the data. You can take at least a couple approaches to the problem

1. create one function that does all the writing. All objects/threads pass write requests to that one function.

2. Synchronize access to the file -- most commonly use a semiphore for that purpose. A semiphone is an operating system resource that blocks threads when it is in use by another thread.

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

Underneath it all, a reference i to object x is typically the machine address of the object x
<snip>
A reference is the object. It is not a pointer to the object, nor a copy of the object. It is the object.

contridition there:eek: either a reference is a pointer or it isn't. If a reference is NOT a pointer then it would not be possible to change the value of the original object to which it references.

A reference is an object only in the sense that, like any other normal pointer, it is a container that holds the address of some other value.

int a = 5;
int& b = a;

b = 6;

In the above code, variable b is not the same as variable a, variable b is a container (has its own space on the stack) that holds the address of a, but it is not just another name for a (unless code optimization takes over, but that's a diferent story altogether).

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

If &x was a pointer to reference, then type of p should be int&* which is illegal.
.

That is not what I posted. I never claimed that was legal and you never posted that example until now.

If that is not what you mean then please post an example.

Finally, we come to agreement -- we were just talking about two different animals.:)

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

Picked from http://www.eternallyconfuzzled.com
A reference is not a pointer. A pointer is not a reference. End of story. Anyone who tries to explain a reference in terms of a pointer, or pointers in terms of a reference is only going to confuse people in the long run.

you stated:

because you cannot take address of reference

I proved that incorrect. Just because you may not understand it does not mean it cannot be done.

Underneath the hood a c++ reference is really a pointer. If you look at the code produced by the compiler you will see that the arguments passed onto the stack for both foo1() and foo2() are identical -- both are c style pointers.

And a pointer most certainly is a reference -- in the more general sense. In c++ the phrase "pass by reference" can mean either by pointer or by c++ reference. There is only two (not three) ways to pass an object, either by reference or by value. Since we can both agree passing by value is not an issue here, then there is only one option left, pass by reference. And both foo1() and foo2() accomplish that.

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

references in c++ are (almost) identical to pointers. a pointer to a reference is really nothing more than a pointer to a pointer, but the syntax is a little simpler. In the below code both foo1() and foo2() do the same thing, foo1() uses a reference and foo2() uses a pointer. Otherwise the two functions are indentical.

#include <iostream>
using namespace std;

void foo1(int& x)
// pointer to reference example
{
	int* p = &x;
	*p = 123;
}

void foo2(int* x)
// pointer to pointer example
{
	int** p = &x;
	**p = 345;
}

int main(int argc, char* argv[])
{
	int abc = 0;
	foo1(abc);
	cout << abc << "\n";
	abc = 0;
	foo2(&abc);
	cout << abc << "\n";
	return 0;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

who said you can't make a pointer to a reference?

void foo(int& x)
{
    int* p = &x;
    *p = 0;
}

If that is not what you mean then please post an example.

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

no I didn't forget it -- it not required in current c or c++ standards. Default is return 0. But some older compilers will complain.

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

Back slapping not stabbing.

what's the difference:mrgreen: :eek: :rolleyes:

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

if you don't know where to start, here's a hint

int main()
{
  // put your code here
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

In fact the newbie posters should have the most rep giving power as they're the ones we help the most, not the old hands back slapping each other....although I don't want to put anyone off either.

how about people with less than 200 posts can give or remove rep? That would solve your old-hands-back-stabbing concerns.

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

Saying Turbo is crap is like saying the Dick Van Dyke Show is crap because it's a 1960's show. It's still better than most comedies on TV today... :)

Well, let us know what schools teach 1960s programming styles? and use 1960s computers (how may of you have used punch cards to do all your programming?)

Turbo C was a great compiler in its day (1980s) (best on the market), but has outlived its usefullness. 16-bit MS-DOS is nearly dead and almost buried, I say almost because there are a very few 16-bit commercial programs still around.

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

Err...

@Mr.Ancient Dragon

I was advised here that the call system ("PAUSE"); calls the operating system procedure which is not very advisable since ther is a switch is the context.

Are there any exceptions to this rule since u have used that stmt in ur code ? Just curious ...

Dev-C++ IDE generated that function when I created the C project, I just didn't bother to change it. The only time I use it is in simple example or test programs, and it doesn't really matter in those cases.

but you are right; there are more efficient and safer ways to accomplish the same thing. I don't ever use system() function in the commercial programs I write at work.

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

maybe something like below, although this isn't exactly like a c++ class, but close. There is nothing to prevent the program from calling function bar() directly from anywhere in the program, while that is possible in a c++ program only if bar() were a static method of the class.

Note that mystruct will not compile with a C compiler if member function pointer is a function name instead of a pointer. (at least with Dev-C++)

struct mystruct
{
   int x,y;
   int (*foo)(struct mystruct* this);
};
int bar(struct mystruct* this);

int bar(struct mystruct* this)
{
   return 0;
}

int main(int argc, char *argv[])
{
  struct mystruct ms;
  ms.foo = bar;
  system("PAUSE");	
  return 0;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
if(equihrs<12)
{
}
else
{
if(equihrs==12)
{
void ampmcalculation();
}
else
{
{
void ampmcalculation(string ampm);
equihrs=equihrs-12;
}

The line in RED above is not calling a function, it is just declaring the function. If you want it to actually call that function you have to remove the "void" in front of the function name, add a parameter to the function call in the first red line, and the word "string" from the parameter list.

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

you could use fwrite() assuming Port_Handle is the handle to an open file. -- see C docs for description of that function.

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

i'm using a borland turbo C

That's your first big mistake! toss that crappy compiler into the bit bucket (delete it from your computer) and get a modern C compiler that you can use to learn the C and C++ languages correctly. You can't learn to drive a 2007 automobile by riding a horse & buggy, so why attempt to learn current computer languages with a compiler that was created probably before you was born?:eek: You can get a very good Dev-C++ compiler for free.

>int id[max];
That is a 2-dimensional array of integers, what you want is a simple one-dimensional arry, like this:
int id[max];

After using scanf() to input an integer the keyboard buffer will still contain the <Enter> key, or '\n'. You need to remove that from the keyboard buffer before calling scanf() again or scanf() will not stop for keyboard input. You can remove the '\n' key by calling getchar().


Dilip already provides some advice -- read it, implement it, then repost your program if you still have problems.

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

Hi all,

This is charan new member of this team.

Iam having one Question to all of you

What is the difference between static and dynamic Dll and how the mechanisim of static dll goes in VC++

The terms static and dynamic do not describe the features of a DLL but how the application program uses them. Any dll which has a *.lib file can be statically linked to the program via its .lib file, just add the name of the library to the list of libraries processed by the linker. Or the DLL can be loaded into memory at runtime by calling the win32 api function LoadLibrary().

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

can someone help me about creating a window in turbo c??
because i can't find anything about creating a window in turbo c!
is there a site explaining or about creating a window in turbo c??

That's because you can't do it with that compiler -- Turbo C is just too ancient. Upgrade to a more modern compiler such as Borland C++ or Dev-C++.

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

Objective-C is a very "thin" layer on top of C. Objective-C is a strict superset of C. That is, it is possible to compile any C program with an Objective-C compiler (this cannot be said of C++). Objective-C derives its syntax from both C and Smalltalk. Most of the syntax (including preprocessing, expressions, function declarations and function calls) is inherited from C, while the syntax for object-oriented features was created to enable Smalltalk-style message passing.

http://en.wikipedia.org/wiki/Objective-C

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

what are the features of c which are not available in c++ ???

There are none. some may be implented in C++ a little differently, but they are all there nontheless. For example, c++ requires typecasting when assigning a void* object to some other kind of pointer, C does not require that. That is a difference in implenentation, not a feature that C has but C++ does not.

>c is not an object oriented programming language
that is a feature of c++ that is not in c. The question was just the opposite.

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

remove the else condition.

if((i==25)&&(input_string=="ca"))
input_string="ba";
//else
if((i==25)&&(input_string=="ba"))
ampm="ca";
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

any plans to actuvate rep power, like you see on many other boards such as this one?

WolfPack commented: good suggestion +3
hollystyles commented: He's fiery hot +2
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You are writing a c++ program, don't the input string to char* -- just use std::string's == operator (and don't use the variable name "string" because it is the name of a c++ class and will confuse the compiler. I don't know the relevance of i, but that is probably something else in your program.

std::string input_string.
getline(cin,input_string);

if(i == 25  && input_string == "string")
{
     // do something
}
else
if(i == 12 && input_string == "strings")
{
     // do something else
}

>>but it manages to fufil the first if-condition but couldn't fufil the second if-condition.

what are the values of i and input_string? put a print statement somewhere or learn to use your compiler's debugger. Also: note the spelling of "string" and "strings" are not the same in your post. Is that true in your actual program? If it is, maybe that is the reason it never falls into the second condition.

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

you will have to

1) learn SQL database language -- SELECT, INSERT and UPDATE are three most commonly used SQL functions.

2) learn how to use ODBC to access the database from C, C++ or most any other computer language. Here is a short tutorial to get you started.

And here are a lot of other links.

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

Scribble tutorial is the only one I know of. There are several books at your local book store or www.amazon.com.

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

The main program cannot access controls in CmEdit class directly because they do not exist at the time you are attempting to access them. CDialog does not initialize the controls until OnInitDialog() is called, which is after DoModal(), and it destroys the controls when the CDialog returns from DoModal() (assuming you are using a model instead of modeless dialog).

To get around that problem I create a public CString object in the CDialog class that can be accessed from outside the CDialog class at any time. If the program needs the text from a CEdit control then the CDialog class sets this public variable before returning from either OnOK() or OnCancel() methods.

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

your program should be passing the structure aboud to other functions by reference instead of by value so that any changes made by the function will be made to the original copy of the structure. When you pass a structure by value the program must make a copy of the sturcutre and pass the copy. Here is an example of how the receiving function should declare the parameter -- not the asterisk.

void insert(id* a)
{
...
<snip>
while(a->idnum > l[i].idnum && l[i].idnum != -1)

You should try to use more descriptibe variable names -- variables a and l are confusing.

Parameter name a in the insert function duplicates and hides the global variable also with the same name. rename the parameter in the insert function to something else.

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

>>What is the best way to go about getting into this field?

get a college degree in computer science or some related field. competition is fierce today and you need all the edge you can get. At your age and with a young family to support that is going to be really tough. But entry into the field is next to impossible without the degree (unlike it was 20 years ago).

You might check out a local temp agency -- sometimes they hire people to fill entry leftl positions.

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

you must set the environment paths (Step #3) as explained here.

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

If you have the Express edition of that compiler you will also have to download the Windows Platform SDK because the compiler is pretty minimal. It says its for M$ Windows 2000 Server but it works that that compiler and XP too. I think there is a link to it in the same place as the link to download the compiler.

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

Of course the OP could attempt to write the program himself:rolleyes:

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

>>i need to point each element.

do you mean you want a pointer that connects element 1 of line 1 to element 1 of line 2? If line 1 and line 2 have correcponding element numbers then do something?

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

since the lines have variable number of entries fscanf() will be little use because it requires fixed length number of entries on the line. Instead, use fgets() to read the entire line into memory than parse for spaces and assign to approirate members of the structure. you can use either strtok() to check for spaces or simply strchr() which will return a pointer to the first space. strtok() is probably easier to work with because it will return a pointer to a null-terminated string, while strchr() will not (you have to do it yourself).

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

here is a pure c++ version that replaces the C-style char array with std::string and removes the tmp variable altogether.

From the looks of this function it must be just a code snippet of a larger more complex function, is that right? If it isn't, then you can remove vector array because it serves no purpose.

ifstream file(filename);
if (file)
{
    std::string line;
    while ( getline(file,line) )
    {
       vector <string> array;
        istringstream iss(line);
        int i=1;
        while ( getline(iss, token, ',') )
        {
            array.push_back(token);
            v_List.SetItemText(nItem, i, token.c_str());
            i++;
        }
 }