grabbing console output help

Hey guys im working on a little console project to help me do some helpful stuff on androids.

I am using Visual C++ 2010. Here is my code:

#include <iostream>
#include <conio.h>
#include <string>

using namespace std;

void main(){
system("adb shell getprop ro.build.version.release");


_getch();
}

"adb shell getprop ro.build.version.release" will simply tell me the android version. Example 2.2.2 or 2.1 etc....

Now I had created a batch script to help me auto install an application based on the OS version. here is that source:

@echo off
color 0A
:home
title MMS Installer By: Roketteere
@echo off
cls
echo.
echo.
echo -=-=-=-=-=-=- MMS Installer By: Roketteere -=-=-=-=-=-=-=-
echo.
echo.
echo -unknown sources and usb debugging must be enabled!
echo.
echo.
echo.
echo PRESS ANY KEY TO AUTOMATICALLY INSTALL THE CORRECT MMS APP!
pause>nul
cls
cd "%~dp0"
adb kill-server
adb start-server
goto:Connect
:Connect
FOR /F "tokens=*" %%i in ('adb get-state') do SET STATE=%%i
IF "%STATE%"=="device" goto :Checkstate
echo Phone is not connected.
pause
goto:Connect

:Checkstate
FOR /F "tokens=*" %%i in ('adb shell getprop ro.build.version.release') do SET STATE=%%i
IF "%STATE%"=="2.1-update1" start adb install 2.1.apk
IF "%STATE%"=="2.1" start adb install -r 2.1.apk
IF "%STATE%"=="2.2" (adb install -r 2.2.apk)
IF "%STATE%"=="2.2.1" (adb install -r 2.2.apk)
IF "%STATE%"=="2.2.2" (adb install -r 2.2.apk)
IF "%STATE%"=="2.3.3" (adb install -r 2.3.3.apk)
IF "%STATE%"=="2.3.4" (adb install -r 2.3.3.apk)
IF "%STATE%"=="2.3.5" (adb install -r 2.3.3.apk)
IF "%STATE%"=="2.3.6" (adb install -r 2.3.6.apk)
IF "%STATE%"=="2.3.7" (adb install -r 2.3.7.apk)
echo.
echo Press Any Key to Exit!
echo.
pause>nul

###############################################

My question is, how would I be able to grab the out put after i put system("MyCommand");

And be able to make it an if statement.

Like if state == 2.1 etc...


Thanks
If this is Android, why did you post in the Windows programming forum? I would recommend that you move the post to General C++ Programming to catch the eye of a broader audience.
Topic archived. No new replies allowed.