GIDForums  

Go Back   GIDForums > Computer Programming Forums > C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 11-Jul-2008, 08:36
u8sand u8sand is offline
New Member
 
Join Date: Jul 2008
Posts: 4
u8sand is on a distinguished road

Was wondering how do you...


I was wondering..
I use Dev C++ And i know that it uses other exe's within the dev c++ files to do operations and things.

So.. How?
If i make a program like this:

CPP / C++ / C Code:
// hi.exe
#include <windows.h>

int main(int num)
{
     return num*2;
}

and another program:

CPP / C++ / C Code:
// hello.exe
#include <windows.h>

int main()
{
     printl(hi.exe(5),"%d"); // hi.exe(5) is what ever the function is
     system("pause");       // to run hi.exe and put 5 into main.
     return 0;
}


OR another way you would do it?

plz post
  #2  
Old 11-Jul-2008, 08:45
fakepoo fakepoo is offline
Regular Member
 
Join Date: Oct 2007
Posts: 713
fakepoo is a jewel in the roughfakepoo is a jewel in the roughfakepoo is a jewel in the rough

Re: Was wondering how do you...


You've already called another program from yours and you probably didn't even know it. See the command system("pause"). You are telling your operating system to run a program called "pause". Let's say you wanted to run the program called "hi.exe" with an argument of 10, you would use:

system("hi.exe 10");
  #3  
Old 11-Jul-2008, 08:46
u8sand u8sand is offline
New Member
 
Join Date: Jul 2008
Posts: 4
u8sand is on a distinguished road

Re: Was wondering how do you...


Quote:
Originally Posted by fakepoo
You've already called another program from yours and you probably didn't even know it. See the command system("pause"). You are telling your operating system to run a program called "pause". Let's say you wanted to run the program called "hi.exe" with an argument of 10, you would use:

system("hi.exe 10");


well i knew i called a program but i dident know you can call a program an add variables that same way..

ty ill try it.
  #4  
Old 11-Jul-2008, 08:57
u8sand u8sand is offline
New Member
 
Join Date: Jul 2008
Posts: 4
u8sand is on a distinguished road

Re: Was wondering how do you...


Can you help me with one more thing.

I wana make it go to the file but the adress of some of the files have spaces,

what would i use instead of space.

i know probly "\x000" but what goes in the 000 ?
  #5  
Old 11-Jul-2008, 09:07
u8sand u8sand is offline
New Member
 
Join Date: Jul 2008
Posts: 4
u8sand is on a distinguished road

Re: Was wondering how do you...


Oh and if anyone wants to do somthing like this i made these functions:

CPP / C++ / C Code:
int GetNum(char URL[255],int input) // returns a number when you input a number
{
    char Buffer[255];
    sprintf(Buffer,"%s %d",URL,input);
    int num = system(Buffer);
    return num;
}

CPP / C++ / C Code:
char GetChar(char URL[255],char input) // returns char when you input a char
{
    char Buffer[255];
    sprintf(Buffer,"%s %s",URL,input);
    int num = system(Buffer);
    return num;
}

CPP / C++ / C Code:
char* GetString(char URL[255],char input[255]) // returns string when you input a string
{
    char Buffer[255];
    sprintf(Buffer,"%s %s",URL,input);
    int num = system(Buffer);
    return num;
}
  #6  
Old 11-Jul-2008, 14:11
fakepoo fakepoo is offline
Regular Member
 
Join Date: Oct 2007
Posts: 713
fakepoo is a jewel in the roughfakepoo is a jewel in the roughfakepoo is a jewel in the rough

Re: Was wondering how do you...


Quote:
Originally Posted by u8sand
Can you help me with one more thing.

I wana make it go to the file but the adress of some of the files have spaces,

what would i use instead of space.

i know probly "\x000" but what goes in the 000 ?
Basically, you need to put in that string whatever you would type in a command-line prompt. So, if you had a path with spaces, I believe that you would need to type the entire path in quotes. Maybe like:

CPP / C++ / C Code:
system("\"C:\\Windows\\My Program Folder\\MyExe.exe\" 10");
 
 

Recent GIDBlogOnce again, no time for hobbies by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
a significant problem after installing Xp mohammad Computer Software Forum - Windows 10 09-Aug-2005 08:03
I was wondering.... n3pla Computer Software Forum - Windows 1 28-Jul-2002 05:33

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 00:11.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.