Author Topic: c++  (Read 7508 times)

d3nn

  • Full Member
  • ***
  • Posts: 169
  • Reputation: 3
    • 7h31310g
  • Badges:
  • Computers: 1 old server, and a new asus
  • iDevices: ipod touch 4g on ios 5
c++
« on: August 03, 2011, 10:46:04 pm »
So I'm basically a total programming noob, but I've been trying to make an exe just to launch a .bat, preferably silently. Does anyone know how to do that in C or C++?
i've tried several suggestions from google, but they've all given me errors.
Liked this post? Come visit my blog!

http://7h31310g.blogspot.com

ghoulmaster

  • Sr. Member
  • ****
  • Posts: 346
  • Reputation: 12
  • Badges:
Re: c++
« Reply #1 on: August 03, 2011, 10:57:45 pm »
system("/path/to/batch.bat")

Hot fries

  • Sr. Member
  • ****
  • Posts: 251
  • Reputation: 6
Re: c++
« Reply #2 on: August 03, 2011, 11:05:35 pm »
Sound simple enough :)

d3nn

  • Full Member
  • ***
  • Posts: 169
  • Reputation: 3
    • 7h31310g
  • Badges:
  • Computers: 1 old server, and a new asus
  • iDevices: ipod touch 4g on ios 5
Re: c++
« Reply #3 on: August 03, 2011, 11:12:48 pm »
@ghoulmaster, I try that and get this error:
Expected constuctor, deconstructor or type conversion before '(' token
expected ',' or ',' before '(token
Liked this post? Come visit my blog!

http://7h31310g.blogspot.com

Trcx528

  • Haxor
  • Hero Member
  • *****
  • Posts: 4540
  • Reputation: 167
  • Google it!
    • iNinjas
  • Badges:
  • Computers: 13" 2011 Macbook Pro, 120 GB SSD and 16 GB of Ram
  • iDevices: None
Re: c++
« Reply #4 on: August 03, 2011, 11:15:45 pm »
what are you using for headers? The #include statements that is. 

Don't like seeing ads? Click here to register!

d3nn

  • Full Member
  • ***
  • Posts: 169
  • Reputation: 3
    • 7h31310g
  • Badges:
  • Computers: 1 old server, and a new asus
  • iDevices: ipod touch 4g on ios 5
Re: c++
« Reply #5 on: August 03, 2011, 11:17:55 pm »
Ummmm... I've got
#include <stdin.h
But that's it, do I need more? Sorry for my total lack of understanding of c.
Liked this post? Come visit my blog!

http://7h31310g.blogspot.com

Trcx528

  • Haxor
  • Hero Member
  • *****
  • Posts: 4540
  • Reputation: 167
  • Google it!
    • iNinjas
  • Badges:
  • Computers: 13" 2011 Macbook Pro, 120 GB SSD and 16 GB of Ram
  • iDevices: None
Re: c++
« Reply #6 on: August 03, 2011, 11:25:30 pm »
I think that you need the  > at the end of that line....

d3nn

  • Full Member
  • ***
  • Posts: 169
  • Reputation: 3
    • 7h31310g
  • Badges:
  • Computers: 1 old server, and a new asus
  • iDevices: ipod touch 4g on ios 5
Re: c++
« Reply #7 on: August 03, 2011, 11:27:55 pm »
Sorry for the typo (im on my ipt) I actually have <stdlib.h> on the computer, not <stdin
Liked this post? Come visit my blog!

http://7h31310g.blogspot.com

Trcx528

  • Haxor
  • Hero Member
  • *****
  • Posts: 4540
  • Reputation: 167
  • Google it!
    • iNinjas
  • Badges:
  • Computers: 13" 2011 Macbook Pro, 120 GB SSD and 16 GB of Ram
  • iDevices: None
Re: c++
« Reply #8 on: August 03, 2011, 11:31:21 pm »
I would add in stdin.h because it seems to be a pretty standard header.  Can you post the entire code that you are working with? 

d3nn

  • Full Member
  • ***
  • Posts: 169
  • Reputation: 3
    • 7h31310g
  • Badges:
  • Computers: 1 old server, and a new asus
  • iDevices: ipod touch 4g on ios 5
Re: c++
« Reply #9 on: August 03, 2011, 11:47:37 pm »
I don't have access to it anymore, but tomorrow I'll post it. It really isn't much more than what ghoulmaster postes + some #includes.
Liked this post? Come visit my blog!

http://7h31310g.blogspot.com

Don't like seeing ads? Click here to register!

PaulBird

  • Sr. Member
  • ****
  • Posts: 485
  • Reputation: 5
  • Every problem is an opportunity in disguise
    • Google
  • Badges:
Re: c++
« Reply #10 on: August 03, 2011, 11:57:33 pm »
iostream dude.
but it seems kinda odd to use c++ to just run a .bat??? unless u are to expand on this program id advise u to use bash or python to do this:) but getting comfortable with c++ is always a good thing, so its good to do everything in it i guess
People Never Get The Flowers While They Can Still Smell Them

A12danrulz

  • Leader
  • Hero Member
  • *****
  • Posts: 4078
  • Reputation: 221
  • Badges:
Re: c++
« Reply #11 on: August 04, 2011, 10:26:42 am »
Code: (C++) [Select]
#include <iostream>
#include <cstdlib>
using namespace std;
int main()
{
     system("/path/to/bat.bat");
     return 0;
}

PaulBird

  • Sr. Member
  • ****
  • Posts: 485
  • Reputation: 5
  • Every problem is an opportunity in disguise
    • Google
  • Badges:
Re: c++
« Reply #12 on: August 04, 2011, 01:51:02 pm »
Lol let him do some on his own xD
But do u need the cstdlib for the system funtion?.?
People Never Get The Flowers While They Can Still Smell Them

A12danrulz

  • Leader
  • Hero Member
  • *****
  • Posts: 4078
  • Reputation: 221
  • Badges:
Re: c++
« Reply #13 on: August 04, 2011, 02:39:43 pm »
IDK I just include that in all of them just to avoid errors.

d3nn

  • Full Member
  • ***
  • Posts: 169
  • Reputation: 3
    • 7h31310g
  • Badges:
  • Computers: 1 old server, and a new asus
  • iDevices: ipod touch 4g on ios 5
Re: c++
« Reply #14 on: August 04, 2011, 04:28:26 pm »
@A12 I compiled and ran it and I think it worked, thanks :) Do you know anyway I could start it invisibly?

@paulbird, I'm only using this small portion of C++ to bundle up my .bats and any other resource files i might use into a nice exe and try to run them silently, but I might branch out into some c++
Liked this post? Come visit my blog!

http://7h31310g.blogspot.com