Freaky_Chris 299 Master Poster

oh sorry lol i read you had created an array of pointers...then just glanced over the code...but you hadn't created and array of pointers

Freaky_Chris 299 Master Poster

wouldn't it have to be

Rules[this->RuleNum]->min->MembraneOut[0]=A.min.MembraneOut[0];

Chris

Freaky_Chris 299 Master Poster

Write it to a new file. then delete original when completed and rename new file :D

Freaky_Chris 299 Master Poster

Read all of the questions into a vector, which is simple enough just takes one loop. Then you can append to the vector and you can remove items from the vector. Then before quitting besure to clear the text file and re-write everything stored in your vector!

Chris

Freaky_Chris 299 Master Poster

There is no need to rate yourself. Your talent comes apparent quite quickly and users will help feed that.

you might want to think about following a few tutorials and getting a reasonable understanding of the language before trying to join projects. As they mostly consist of people who know a bit more about what they are doing.
http://www.cprogramming.com
httP://www.cplusplus.com
Those are two rather nice tutorials. There are always more on Google, you should always get yourself a good reference too. I'm quite fond on this one
http://www.cplusplus.com/reference
But again Google will turn up some results and you can choose yourself which is your favourite.

You may want to find some small programming challenges too, I believe you can find a reasonable number listed throughout this site. They will help you secure the knowledge you have gained. My best piece of advise to you is that you practise! In the business practise is everything.

Chris

Freaky_Chris 299 Master Poster

Flag this for move...or move it now! please :DDDD

@OP: read the rules about posting please

Chris

Freaky_Chris 299 Master Poster

pass an array to it and let it edit that arrays data

Freaky_Chris 299 Master Poster

Java comes with the Java2D API which allows you to create game in 2D, Get googling :D

Chris

Freaky_Chris 299 Master Poster

There are a few, the tutorials normal suggest something. Such as Code::Blocks or Micro$oft Visual C++ (Express 2008 is free)

Google is your friend

Chris

Freaky_Chris 299 Master Poster

Dive into C++, and get googling for C++ tutorials. http://www.cprogramming.com
http://www.cplusplus.com
Some starting links

Chris

Freaky_Chris 299 Master Poster

Sorry I missed the question. '\' is used to escape characters such as '\n' is a newline as you may well no or '\a' is a bleep. Because it's a special escape character in string you must escape it if you wish to use one. Hence the double slash.

Chris

Freaky_Chris 299 Master Poster

We'll give it a miss if you mark the thread as solved :P

Chris

Freaky_Chris 299 Master Poster

can you not see the () on open? Its just you have two parameters inbetween them :P

You will need to escape that '\' characters
"C:\\programs\\fileneedschanges"
Then t shold work fine

Chris

Comatose commented: :) +8
Bladtman242 commented: well, it solved my problem +1
Freaky_Chris 299 Master Poster

Here's a small example using vectors, it's nothing special, just something i made to show you how size does not matter.

#include <iostream>
#include <vector>
#include <string>
#include <ctime>

int main(void){
    std::vector<std::string> v;
    std::string text = "abcdefghijklmnopqrstuvwxyz";
    std::string temp = "";
    
    srand((unsigned)time(NULL));
    int x = rand() % 100;
    int z = 0;
    
    for(int i = 0; i < x; i++){
            z = rand() % 20 + 1;
            for(int q = 0; q < z; q++){
                    temp.push_back(text[rand()%26]);
            }
            v.push_back(temp);
            temp.clear();
    }
    
    for(int i = 0; i < v.size(); i++)
            std::cout << "v[" << i << "]: " << v[i] << std::endl;
   
    return 0;
}

Chris

Freaky_Chris 299 Master Poster

Firstly you should use

while(getline(myfile, line)){}

rather than

while(!myfile.eof()){}

this is because eof() can return true before the end of a file with some excape characters.

Secondly look into the vector header its wonderful its designed with this sort of thing in mind!

Chris

Freaky_Chris 299 Master Poster

you need to pass your vector by reference

Chris

Freaky_Chris 299 Master Poster

look into pipes

Chris

Freaky_Chris 299 Master Poster

What exactly do you mean by hide, as in minimize? if so then look at CloseWindow().

Otherwise you will need to explain more.

Chris

Freaky_Chris 299 Master Poster
ddanbe commented: There should be a template for your answer. +3
Freaky_Chris 299 Master Poster
Freaky_Chris 299 Master Poster

Your Welcome,
Go ahead and mark this as solved.

Chris

Freaky_Chris 299 Master Poster

Indeed createprocess is the much better choice, it gives you much more control over the outcome of everything.

BTW: IF it's solved could you please mark the thread as solved

Thanks,
Chris

Freaky_Chris 299 Master Poster

The concept is exactly the same, server/client or client/client it really is upto you. Lets say you go for server/client the more likely. Y9ou have the server set up to listen for connections and spawn new threads to deal with no connections recieved and forward data from an incoming socket to another outbound socket. The client will send a socket connection request to the servers IP address once connect is then free to recieve and send information as desired.

Chris

Freaky_Chris 299 Master Poster
ofstream myfile("example.txt", std::ios::app);

Hope that helps :P
app stands for append btw

Chris

Freaky_Chris 299 Master Poster

I agree with clockowl.
Anyway, when you say you were asked....by who your lecturer. Something tells me you wouldn't be asked to do something like this if you hadn't already been taught most if not all the material you need to do this. I suggest you look at winsock. It might be a good place for you to start...presuming your developing on windows and for windows OS's of course we don't know these things.

Chris

Freaky_Chris 299 Master Poster
Freaky_Chris 299 Master Poster

Can i suggest you store the value of BM outside of the structure and store it in a char array of size 2 then write each one to the file before calling write() on the structure.

Chris

Freaky_Chris 299 Master Poster

Hey, could you share some more information with us. Specifically what OS and Compiler you are using.

Thanks,
Chris

Freaky_Chris 299 Master Poster

thats the function prototype, it shows that the function has a return type of HWND andtakes two parameters. A HWND and an UINT. msdn then explains what each of the parameters are, it also lists all the possible options for the UINT uCmd and then it states what exactly is returned.

Chris

Comatose commented: Good Description, Clear... Concise. +8
Freaky_Chris 299 Master Poster

Well if you store all the information into a map, then could just call the map by the name...
http://www.cplusplus.com/reference/stl/map/

Chris

Freaky_Chris 299 Master Poster

erm did i miss something or do you not just want an array?

atom myAtoms[100];

Chris

Freaky_Chris 299 Master Poster

take a look at the ctime header. If you need more accurate results then you will have to go into OS specific functions

Chris

Freaky_Chris 299 Master Poster

I think your going to have to give more detail here...Are you using MFC? If so then a password box will automatically do this....

Again we really need more information

Chris

Salem commented: Yes we do :) +26
Freaky_Chris 299 Master Poster

I will take your advice, and improve it. But cut me some slack :icon_lol: ...
I made this when I was 14 I think, didn't seem too bad at the time. XD

As for the control key always being left on, I could never quite figure out why that was happening, the keyboard hook stopped windows from processing it. I will try Block Input though, hopefully this is still helping chrischavez solve his problem (as well as mine) :D .

You need to pass the ctrl key press with the KEYEVENTF_KEYUP flag. That way it wont *stick* so to speak.

I guess blocking input might be a bad idea since then you have no way of using the ctrl lol....there might be a way to sort it out. have a play with it i guess.

Chris

Freaky_Chris 299 Master Poster

Not too bad William, the only one thing that annoys me about that is the fact that when pressing the ctrl key to simulate a left mouse click it is a big grrr. For example, you should either A) Block input on the ctrl key being sent and just send mouse input or B) Send a left ctrl key up event so that it is not stuck on!

Chris

Freaky_Chris 299 Master Poster

Sure.

POINT mousePos;
GetCursorPos(&mousePos);
std::cout<< "X: " << mousePos.x << std::endl;
std::cout<< "Y: " << mousePos.y << std::endl;

hope that makes sense.

Chris

Freaky_Chris 299 Master Poster

You can use SetCursorPos() to control the position of the cursor. It returns true is it succeeds and false if not. It takes 2 arguments int x and int y. You can use GetCursorPos() to retrieve the position of cursor. it returns the same as Set...() it takes one paramater a pointer to a structure of type POINT, which contains to values long x and long y. Also if you want to send Mouse clicks then you will need to look into the function SendInput() its well documented on msdn but feel free to ask for more information.

Chris

Freaky_Chris 299 Master Poster

From what i am understanding adding this
GLUT_BUILDING_LIB
Fixed the original problem. Now you are trying to compile glut code. To do this not only do you need to include the header files but also the library files....you need to tell the linker which library files it will need.

Chris

Freaky_Chris 299 Master Poster

Sounds to me like you need to link the required libraries into your project ready for linking

Chris

Freaky_Chris 299 Master Poster

that did absolutely nothing, but thanks for trying. I think the problem is that its not getting to the code for some reason maybe the while loop or something? i dunno but chris you prolly hit the code that said error cant open executable code.

Follow MosaicFuneral's Advice. the reason your program is terminating is due to the fact you have a vector of type string and you are trying to push an integer into it, see the problem?

Chris

Freaky_Chris 299 Master Poster

It worked fine for me. Try adding this at the end instead.

cin.ignore(100, '\n');
cin.get();

Chris

Freaky_Chris 299 Master Poster
for(int i=0;(i<50000 && (!Ofile.eof())) ; i++ ){
    Ofile << arry;
    if(arry[i]<1 && (arry[i+1] && arry[i+2] == 0) ){
       break;
    }
    cout<<arry[i];
}

Do not use eof() it can return true before the end of file is actually reached.

Ofile << arry; shouldn't you be reading from the file not trying to write to it? Which would also mean you need to reopen it as an instream.

arry[i]<1 && (arry[i+1] && arry[i+2] == 0)

This is evaluated as the following not what you are expecting

(arry[i]<1) && (arry[i+1]) && (arry[i+2] == 0)

Chris

Freaky_Chris 299 Master Poster

When you create a pointer to a type you reserve enough space in memory for the the variable. When you call new you actually allocate the memory to the program so it cannot be used by another program.

Chris

Freaky_Chris 299 Master Poster

Your last else has no if to go with it.....

Chris

Freaky_Chris 299 Master Poster

I tend to rush some poor front end of some kind, so i can create the back end to interact with the front end more accurately. Then I go back and redesign the front end.

Sort of a testing/debugging front end more than an actually front end.

Chris

Freaky_Chris 299 Master Poster

No cin.ignore() is designed to clear everything before a given character or for a given length, not clear the given character.

Chris

Freaky_Chris 299 Master Poster

>Providing your developing on a windows machine and want unportable code.
Fair enough ;)

#include <fstream>

int main()
{
  std::ifstream in( "source", std::ios::in );
  std::ofstream out( "target", std::ios::out );
  out << in.rdbuf();
}

Shortest portable way I can think of.

fair enough, now all thats leftfor me to pull you up on is your lack of a return :D

Chris

Freaky_Chris 299 Master Poster

Or simply?

#include <windows.h>

int main()
{
  CopyFile( "source", "destination", true );
}

Providing your developing on a windows machine and want unportable code.

Freaky_Chris 299 Master Poster

Static memory space is generally very limited, if you want to create large array sizes then you need to use dynamic memory.

__int64 *array = new __int64[2000000];

But be sure to delete the array afterwards

delete []array;
array = NULL; // to make sure you do not use the pointer

Chris

Freaky_Chris 299 Master Poster

You're still calling srand() more than once.

Also try indenting your code and you might see your problem! Or at least stand a chance, thats too painful to try and read tbh.

Chris