![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Professional Programmer
Join Date: Feb 2009
Posts: 280
Rep Power: 2
![]() |
Auto create
Hello, Iam trying to make a program to do something for me. Though I did it in php for linux system, I dont think i can use it in windows.. So its c++ time
![]() I have a folder called "done" when any file goes into done it opens maketorrent and then creates a .torrent file and saves it into a file called "tdone" Any clue on how to do this :O or even better were to start? Thanks squill |
|
|
|
|
|
#2 |
|
Professional Programmer
Join Date: Jan 2006
Location: Ontario, Canada
Posts: 417
Rep Power: 5
![]() |
Re: Auto create
This doesn't sound too complex. You should try and break it down into sections.
First, you need code to check if a file exists; this can be done using fstream (Google this, there will be lots of examples). Next you the have to put this in a loop to keep checking for a file. Inside this loop you can check if the file exists, if it doesn't, sleep for a minute, or however long you want, when the sleep is over it will check again. You will not want the sleep to be too short or it will bog down your system. Once the file is found you can process it. I am not familiar with MakeTorrent, but if you can call it from command line passing in the file you found as a parameter, it should be pretty easy to call from c++. There are a few options for calling processes from c++; you said you were writing this in Windows, so the win32 function CreateProcess should do the trick. This is how I would break it down. Hopefully this gets the thought process moving.
__________________
I am Addicted to Linux! |
|
|
|
|
|
#3 | |
|
Professional Programmer
Join Date: Feb 2009
Posts: 280
Rep Power: 2
![]() |
Re: Auto create
Thanks, Seam to hit it on the head..going to do some research, as i was practicing using php threw line command.. anyhow maketorrent can be called but must use MinGW which is kind of new to me.. soo off to do alot of research.. and sure ill have questions later
![]() thanks again squills also Quote:
thanks squills |
|
|
|
|
|
|
#4 | |
|
Professional Programmer
Join Date: Jan 2006
Location: Ontario, Canada
Posts: 417
Rep Power: 5
![]() |
Re: Auto create
Quote:
http://www.boost.org/
__________________
I am Addicted to Linux! |
|
|
|
|
|
|
#5 |
|
Professional Programmer
Join Date: Feb 2009
Posts: 280
Rep Power: 2
![]() |
Re: Auto create
ok , i got a good idea on this firs part.. But whats buggin me is the maketorrent file i have to run is a makefile, so i used in linux this code.. but not sure how to write it for windows and haveing to have it use MinGW
echo shell_exec('./mktorrent -a http://blahblah.net/announce.php -o '.$TmpDir.$Item.'.torrent '.$GotDir.$Item.'/');any idea's on this... |
|
|
|
|
|
#6 |
|
Professional Programmer
Join Date: Jan 2006
Location: Ontario, Canada
Posts: 417
Rep Power: 5
![]() |
Re: Auto create
You can use the CreateProcess function I mentioned above. Basically it takes the application name as the first param (mktorrent), and then the rest of the parameters you pass in with it. To use this you will probably have to include the windows header file. More information can be found here:
http://msdn.microsoft.com/en-us/libr...8VS.85%29.aspx Another thread I found on running external programs from c/c++: http://www.dreamincode.net/forums/in...howtopic=18057
__________________
I am Addicted to Linux! Last edited by King; Feb 24th, 2010 at 7:57 AM. Reason: Added link |
|
|
|
|
|
#7 |
|
Professional Programmer
Join Date: Feb 2009
Posts: 280
Rep Power: 2
![]() |
Re: Auto create
Thanks for your help, I belive its working
![]() |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Open Source free HonoCMS (asp,php,jsp.net) auto code generate | hightgig | Show Off Your Open Source Projects | 3 | Jun 9th, 2010 1:01 AM |
| Problem to create a global object, to use objects created inside a method etc... | colt | Java | 2 | Jul 12th, 2009 1:52 PM |
| fedora USB create boot image script | kdepfyffer | Bash / Shell Scripting | 2 | May 25th, 2005 8:31 AM |