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

On the openfile line, are you telling the compiler that it should check the following:

fstream::in (or) fstream::out (or) fstream::app???

if so you are short 1 | for each instance (an OR command is ||)..

if not, then completely disregard all the above and kind of explain what you're trying to accomplish on that line.

Wrong. The | operator is NOT a boolean operator but instead is a bitwise OR which adds the values together. The op's use of the | operator is correct.

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

system(d.c_str()); system() takes a const char*, not std::string

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

Thread closed.

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

Well, i believe that a simple thanks is enough for you and for your try.You make me mad due to yours behavior.I didn't say that you have got enough knowledge,but i believe and thats the start of my continue in this forum that you should be more polite to the others.

If you can't stand the heat then get out of the kitchen. That means -- take constructive criticism for what its worth. When you post crappy C code that has no chance to compile on any C compiler then you have to expect unfavorable criticism.

Don't get mad at Narue -- you should be mad at yourself for doing such a poor job at writing C code.

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

>>there is no need to explicitly call the constructor in the Class B,
Actually, that isn't possible anyway. Class constructors are never explicitely called. They are called when the compiler constructs the object.

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

blessing12 has already been banned by someone, so I doubt you will get any more of those PMs.

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

If you want to initialize aa with something other than 0, here is one way. You don't have to do anything to initilize it with 0 because A's constructor already does that.

class A
{
private:
    int aa;
public:
    A() {aa = 0;}
    set(int x) {aa = x;}

};

class B
{
private:
    A obj[10]:
public:
    B()
    {
        for(int i = 0; i < 10; i++)
            obj[i].set(i);
    }
};
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You should be asking specific Blender questions in their form -- click here. I see Python mentioned frequently, but not c++. So I don't know if its possible to use c++ with it or not. You'll have to ask them.

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

*nix shared memory with semiphores

Despite my previous statement, I think you only need one semiphore to synchronize access to that array of objects. Semiphones for each array element isn't necessary because you are doing your own reference counting for each connection object.

For any given process, this is what I would do to gain control of a connection object. Similar method to free a connection object, except of course you decrement the reference count.

forever loop
     Get semiphone (wait indefinitely until it is available)
     Is a free connection object available
         Yes, increment connection object, release semiphone, and exit loop
         None available, release semiphone, sleep a few clock ticks to allow context switch,
            then return to top of forever loop
end of forever loop

Under MS-Windows you wouldn't need that shared memory array, just create 5 semiphones, then call WaitForMultipleObjects( ... ) to gain access to the first available semiphone. I don't know if anything similar is available on *nix or not.

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

You might need two locks -- one for the entire array and another for each element of the array. First lock the array itself, lock the array element, then unlock the array so that another thread can use the array.

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

its true dev has no gui design tools -- but neither does Express c++. That doesn't mean you can'g create gui windows with those two compilers. win32 api doesn't require a gui design tool. Afterall, that's how all windows programs were originally written.

>>Blender 3d for the models
You'll have to check with whoever produces that to see what compilers they support.

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

you can remove the comma by shifting all other characters left one place, assuming the string is in read/write memory.

char str[] = "25,000";
// locate the comma
char* ptr = strchr(str,',');
// shift remaining characters left 1 place
memmove(ptr, ptr+1, strlen(ptr+1) + 1);
jephthah commented: but mine is a bazillion lines longer than yours!! :P +4
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The cost will depend on location. Los Vegas or Hong Kong will cost quite a few millions, if not billions. Someone is building a new 3-story motel not far from where I live and they probably paid only about $100,000 USD or so for it (my guess) because its not in a very good location.

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

Congrats on your 1000th post -- that impressive and feels sooooooooooooo good! After that, its sort of ho-hum.

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

The dev c++ provides no visual GUI design tools, so that compiler is out. i might just bite the bullet and buy visual c++

BattlingMaxo

Not correct. Dev-C++ provides all the functionality as VC++ 2008 Express, except the debuggin in Dev-C++ sucks cannel water. But you can write Windows programs with it using win32 api.

My guess is that you will NOT need MFC of the others you mentioned for your project. What 3d engine do you plan to use? That will probably tell you wither you can use the free Express edition or whether you need the Professional edition of the compiler.

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

For some reason I was having some problems with it too. I think ifstream and ofstream are easier to use than fstream, but I finally got it working. Here is what I did -- its somewhat different than what you posted because 1) its in English, and 2) I only tested AdicionaAluno() function.

My version initializes the empty file with records that contain the student id numbers but blank names. I think that makes it somewhat easier to debug the program because you can send the file to Notepad and see something other than all spaces. That also means that AdicionaAluno() can either add or update a student record.

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

struct student
{
    char id[5];
    char name[81];
};

void AdicionaAluno(fstream& file)
{
  student part;
  student temp_part;

  int rec_num;

  memset(&part,0,sizeof(student));
  cout << "Enter ID:";
  cin.getline(part.id, 5);

  rec_num = atol(part.id);

  cout << "\nEnter name: ";
  cin.getline(part.name, 81);
  unsigned offset = (rec_num-1) * sizeof(student);
  file.seekg( offset, ios_base::beg);
  if(offset != (unsigned)file.tellg())
  {
      cout << "Error seeking to record " << rec_num << "\n";
      return;
  }

  sprintf(part.id,"%04d", rec_num);
  file.read( (char *)&temp_part, sizeof(student) );
  if ( strcmp(temp_part.id, part.id) == 0)
	 {
		file.seekg( -(long)sizeof(student), ios::cur);
		file.write( (char *)&part, sizeof(student) );
		cout << "\nRecord " << part.id << " added or updated to file.";
	 }
  else
	 cout << "\nInvalid student id.\n";
} //End of AdicionaAluno


int main ()
{
    fstream part_file;
    student null_part;
    memset(&null_part,0, sizeof(student));
    null_part.id[0] = ' ';
    null_part.name[0] = ' ';
    //Open the file for reading to see …
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

depends on what lock() and unlock() do -- they are not standard c or c++ functions. If you use a semiphore, they are valid throughout a thread, not just the function in which they were used. I suspect lock() and unlock() does that too.

Threads, not functions, lock and unlock access to objects.

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

"If the sun shine at night, we wouldn't have the beautiful moonbeam"

Both statements are false -- the sun does shine at night, just not where you are. And I've seen both the sun and the moon at the same time.

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

This problem just now happened to me in this thread. My last post and the one after it are in reverse order. Lardmeister post #4 was there before I made my post. And when I hit the Post Quick Reply button I got an error of some sort (don't know what it was).

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

They are just jealous *nix users because MS-Windows is soooooo much easier to learn and use.

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

> ~Clarie Sargent, Arizona senatorial candidate
> generall geekiness
What's with all the military ranks AD?

"Who is general failure, and why is he trying to read my hard disk?"

I just shortened the thread title -- you wouldn't believe what it was originally generall geekiness is the OPs words, not mine. :)

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

>>how do i make both threads have access to the same set of updated data, when they call different functions?

Look up the term "thread synchronization". Use a semiphore to lock one thread out while another thread is using the object.

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

Welcome to DaniWeb. Soooo, you found out that the grass wasn't as green on the other side of the fense as you thought it was :)

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

Hi. I edited the thread title so that it didn't appear soo spammy.

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

When growing up on the farm during 1950's and 60's we had a cow and never had pasterized milk. Mom just ran it through a strainer to get all the dirt out then chilled it. My parents also took milk sames to a local diary to have tested for diseases, none ever found that I know of. As for home-grown vegies -- we had lots of it, and only washed it to get the dirt off.

Germs?? we had lots of those too, working around farm animals we tend to get a lot of germs on our hands, feet, and nearly every other part of our bodies. I can't count the number of times I've stepped in cow and pig shit. And I suspect farmers do the same even today.

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

I'm not 100% that this is a VB related question...
Can a mod move it to a more appropriate section on the forum? It might help the OP get a better answer.

Next time please just hit the Flag Bag Post button so that we can react faster.

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

nevermind. moron has a brain afterall

brain fart :)

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

Vista moved the location of your home directory -- they are now located in c:\Users. Is that what you mean?

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

I just went to Trafficera.com and didn't have any problems leaving the site. But I didn't do anything while there either. What did you do when you were there so that I can try to reproduce your problem?

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

Click the Start button, then the arrow in the lower right corner of the menu. I don't have a laptop but on a PC that arrow shows a menu that says reboot. See the circle in the attached bitmap picture

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

>>Vista users have you already installed windows malicious software removal tool?
I don't know what tool you mean.

>>How about the microsoft silverlight which is optional? what does this do
All I know is that its a device driver update. See this link

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

Holy Crap! My computer has gone down hill. It was 9.18 on Aug 1 2008, but went down to 6.67 on Aug 22, due mostly to the text screensaver not responding. I guess I'll just have to disable the screen saver to keep that from happening.

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

>> finally managed to remove the highly inaccessible (and possibly ilegal) evil dancing letter verification code and replaced it with the 'answer the simple question' verification tool

That's a great idea :icon_idea: I'm 65 and have had cataracts removed from both eyes, and I too have difficulty reading those damed letters. I know of one site where I tried three four times without success, so I never went back to it. But for legality -- I doubt they are illegal. I can't imagine the difficulties that nearly blind people have.

Other that that statement, I can't answer your question. Hopefully there is someone else who can.

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

compile it for debug then seg fault will procduce a core file. Use the debugger on the core file and it will tell you what line caused the problem. Click here for more info.

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

After getting the last integer and before the next string (author) you need to flush the input string of the '\n' line terminator that's left there by the >> operator. See the Read Me How To Flush The Input Stream thread about how to do that. I'm sure that will fix the problem.

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

I fixed up your program in your post #3 this time so that it uses code tags correctly as previously explained. In futures posts please do two things

1) Use spaces instead of tabs because tabs look awful. I'll bet the editor that you use has an option to use either tabs or spaces. Set it to spaces and your program will look pretty with any editor or web site where you wish to post it.

2) use code tags.

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

>>Help Please!!
Please help with what? Post what you have done to solve the problem.

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

Didn't you read any of these google links?

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

RAM isn't the problem -- size of the executable program is. There is a maximum size of any executable that runs on MS-Windows -- I recall reading that somewhere awhile back but don't recall exactly where.

>>using DLLs now would require big rewrite of code and is unfeasible.
You don't have to convert the entire program to DLLs -- just enough to get you out of your current development standstill. unfeasible??? which is better -- rewriting parts of the code to use DLLs, or stopping all current and future program development. You need a fix to the problem and I think DLLs is the only solution you have.

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

>>i'm a first year college student and just starting with turbo c.
OMG go to a different college immediately because you won't learn anything where you are at. That compiler has been obsolete for at least 15 years that I know of.

>>unable to open include file conio.h
Check the compiler's include directory to see if that file really exists or not.

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

We are not a shoftware whorehouse. So write your own functions.

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

See the Tech Talk board, located at the top of every DaniWeb page.

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

my guess is that filename.asm is not in the directory where you are trying to assemble it. That, or you named the file something else.

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

you are attempting to pass just one element of the array, not the whole array. When passing the array you have to leave out the subscripts comparison (number);

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

Since it goes over your head and you really don't have the slightest clue, have your brother whose writing the program create his own thread here so that he can ask an intelligent question.

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

line 25: what's the value of i and j? A: random

line 33: you are using the assignment operator = instead of the boolean operator ==.

which of the lines you posted is line 52 in your real program (error #1)

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

Welcome to DaniWeb. Please tell us a bit about yourself -- such as where you're from and who you are.

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

Welcome to DaniWeb.

>>Psychotherapist in a Community Health Clinic
Great! There are a few people here that need a good shrink :)

>>Stuff I dislike: Rude, uncaring people --- people who act like you owe them a living ---
>>people who are capable yet refuse to help themselves

Yes, you will fit right in around here:)

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

Also, check out this c++ class