Monday, December 28, 2009

C stuff

How to add non-printable characters to a string

 strcat(test2,"\x01");  01 -- is non-printable ascii character.

 

 

I will be updating the new stuff which come across in C language here, Hope it will be useful. 1. is the header file contains bool datatypes. 2. To read strings from the keyboard we can use two functions: fgets() -- reads a line from fd specified, it will also '\n' which u pass after giving the string so u need to over write it with '\0' . getchar() -- reads character by character. scanf() -- can be used but "white space" is the delimiter in the scanf, if the string has a "white space" in it the string will be treated as two strings. 3. strchr(, ) will retun the address of the character in the string if it is, or else it will return null. 4. every running program will associated with three standard files -- stdout, stderr,stdin. fflush() - Input/Output is nearly 1000 times slower than your processor. Thus it makes no sense for your code to stop executing while the system is writing data somewhere. (you have no choice but to wait if it is reading data - after all you need to do something with it) So what systems do is, store that data into a buffer to output it (to disk or screen) later, and continue executing your program... But what if you do not want this lazy thing to happen. Say you want to tell the user - "everything is written to pen drive. safe to remove pen drive" and there is your lazy system which will do this later!! This is the place to say fflush - (short for flush file) that forces all input/output to complete. It is a common, though incorrect practice to use fflush on the input stream, in order to clear any extraneous input left behind by a scanf function. This may not work in all compilers, and should generally be avoided. File operations: fopen(), fclose(), rewind(), fseek(), fgets(), fputs() void perror(const char *s); --The perror() function shall map the error number accessed through the symbol errno to a language-dependent error message, which shall be written to the standard error stream malloc(),calloc() and realloc(): void *malloc(size_t size): Returns unintialized memory of size "size", retuns "null" if memory is not available. void *calloc(size_t nelem, size_t elsize): Returns intialized memory with 0 of nelem variables of size "elsize". void *realloc(void *ptr, size_t size): changes the size of the object pointed to by ptr to the size specified by size, and returns a pointer to the possibly moved block. The contents are unchanged up to the lesser of the new and old sizes. If ptr is null, realloc() behaves like malloc() for the specified size. If size is zero (0) and ptr is not a null pointer, the object pointed to is freed.

Saturday, December 19, 2009

BSNL Broadband

Over come ""error 676: the phone line busy"
GOTO DSL ROUTER SITE (http://192.168.1.1).. PASSWORD N LOGIN ID IS
"ADMIN"
AND CLICK ON ADVANCE SETUP THEN CLICK ON WAN ...

HERE U WILL SEE SOME VALUES (((VPI/VCI 0/35 Con. ID Category Service
Interface Protocol Igmp QoS State ))) AND ON 1ST OPTION {VPI/VCI 0/35}
TICK THE REMOVE OPTION AND REMOVE IT......THEN CLICK ON ADD OPTION AND CLICK NEXT NEXT AND LAST SAVE IT

....U HAVE TO DO NOTHING;;; DONT CHANGE ANYTHING VALUES THAT WILL COME ..ALL ARE PRE SET AND SO AFTER SAVE
CLICK ON SAVE/REBOOT.......
UR DONE .......... .....
THIS IS SOLUTION FOR PHONE

Not able to connect to the router 192.168.1.1 says page cannot be displayed
go to your local area connection's properties
in tcp/ip connections keep it to :use the following ip address" then in
ip address = 192.168.1.2
subnet mask = 255.255.255.0 (automatically it will take or else you type it)
default gateway = 192.168.1.1

PPPoE & Bridge mode:
PPPoE
(1) PPPoE modem is an always connected mode.(userid and password stored in modem)
(2) For getting good speed with torrents ports are required to be forwarded.
(3) For connecting multiple PCs modem must be in PPPoE mode.
(4) Telenet scripts are required for scheduled automatic booting and re booting.
(5) More secured.

Bridge mode
(1) Connects to net through dialer by entering userid and password
(2) No need of port forwarding for torrents as all ports are open
(3) Telenet scripts are not required for scheduled downloads.
(4) Strong firewalls required as as all ports r open.


Reference:
change from bridge mode to pppoe mode: http://www.chennai.bsnl.co.in/BBS/Wireless/WirelessSecurity.htm#WA3002_Modem_configuration:
http://www.indiabroadband.net/bsnl-broadband/10489-phone-line-busy-error-ut300r2u-modem-here-100-solution.html
http://www.indiabroadband.net/bsnl-broadband/15507-not-able-connect-router-192-168-1-1-says-page-cannot-displayed.html
http://www.indiabroadband.net/bsnl-broadband/8088-pppoe-bridge-mode.html
http://en.kioskea.net/forum/affich-91194-bsnl-wifi-iti-dna-a211-1