Easy Clarity - Connect Easily!

less than 1 minute read

'Disconnection' is a routine process in dial up internet. Here is an C++ snippet which dials BSNL WLL Clarity without asking for password again and again. It automatically closes on disconnection with a beep sound.

/*
 *      easyclarity.cpp
 *
 *      Copyright 2009 Ershad K  ershad92@gmail.com
 *      Licensed under GPL Version 3
 *
 *      Please change USERNAME, PASSWORD and compile with g++
 *      To compile - g++ easyclarity.cpp
 *      To execute - ./a.out
 */

#include <iostream>
#include <stdlib.h>
#include <stdio.h>

using namespace std;

int main ()
{
	char username[] = "USERNAME";
	char password[] = "PASSWORD";
	puts("n EasyClarity - Connect wisely!  www.ershadk.wordpress.comnn");
	ofstream myfile;
	system("sudo wvdialconf");
	myfile.open ("/etc/widial.conf");
        myfile << "[Dialer Defaults]nInit1 = ATZnInit2 = ATQ0 V1 E1 S0=0 "
               << "&C1 &D2 +FCLASS=0nInit3 = at+crm=1;+cmux=1;+cps=33;+cta=0"
               << "nModem Type = Analog ModemnISDN = 0nPhone = #777nModem"
               << " = /dev/ttyUSB0nUsername = "<<username<<"nPassword = "
               <<password<<"nBaud = 460800nStupid Mode = 1nAuto DNSnCheck"
                <<" Def Route";
	myfile.close();
	system("sudo wvdial");
	cout << "a";
	return 0;
}

Leave a Comment

Your email address will not be published. Required fields are marked *

Loading...