Showing posts with label programming. Show all posts
Showing posts with label programming. Show all posts
Wednesday, 29 May 2013
Knight Rider - C program
This is a program I created when I stumbled upon the system calls of C programming.It is very easy to understand.Hope you'll like it.
#include <windows.h>
#include <stdio.h>
/*ZINHAYA. ;) */
int main()
{
int intRef1 = 0, intRef2 = 0;
printf("Like Zinhaya ;)");
sleep(300);
for(;0 == 0;)
{
for(intRef1 = 0; intRef1 < 60; intRef1++)
{
for(intRef2 = 0; intRef2 < intRef1; intRef2++)
{
printf(" ");
}
printf("***");
Sleep(100);
system("cls");
}
for(intRef1 = 59; intRef1 > 0; intRef1--)
{
for(intRef2 = 0; intRef2 < intRef1; intRef2++)
{
printf(" ");
}
printf("***");
Sleep(50);
system("cls");
}
}
return 0;
Comment if you can improve the code...Thanks.
Tuesday, 7 May 2013
Setup and Using Cygwin to compile C programs
Get that Linux feeling - in Windows!
Cygwin is...
- a collection of tools which provide a Linux look and feel environment for Windows.
- a DLL (cygwin1.dll) which acts as a Linux API layer providing substantial Linux API functionality.
Cygwin isn't...
- a way to run native Linux apps on Windows. You must rebuild your application from source if you want it to run on Windows.
- a way to magically make native Windows apps aware of UNIX® functionality like signals, ptys, etc. Again, you need to build your appsfrom source if you want to take advantage of Cygwin functionality.
The Cygwin DLL currently works with all recent, commercially released x86 32 bit and 64 bit versions of Windows, with the exception of Windows CE and Windows NT4.
- For more information see the FAQ.
Installation
- Go to http://cygwin.com/install.html and download the setup.exe
- Then run it,you'll get this window,press run.
- Then continue with the installation ,use standard settings.
- When you get to the Cygwin Setup - Select Packages window,from which you can select components you want to install.
The default components and the "gcc-core: C Compiler" will be all we want.
To select this component, click the plus sign (+) next to the Devel category and scroll down until you find the gcc-core:C Compiler component.Click the word "skip" to select the component for installation.
- Then you can continue your installation without any difficulty in the normal way.
- Depending on your specific installation (Cygwin version) and configuration (components selected) of Cygwin, you may need to have Cygwin’s bin directory, referenced next, added to your system’s PATH environment variable.
One trick is to launch a Microsoft-based command shell (DOS window) by typing the keyword "cmd" from the Run dialog box accessed via the Start menu.From the c:\ prompt (in the command
shell), type:
PATH %PATH%;c:\cygwin\bin
This should do the trick.If necessary, consult your system’s documentation for more information on environment variables and specifically updating the PATH system variable.
________________________________________________________________
Writing & Compiling a C program...
- To create a new C program invoke a text editor such as nano or VIM by the command shown below.
nano hello.c or vim hello.c
- Once you've created a C program using an editor,you are ready to compile your C program using gcc. To do that type the following from the Cygwin UNIX shell:
- if your program compiles successfully, gcc will create a new executable file called "a.exe".(maybe "a.out").
- There is a specified syntax to create a executable file with a unique name
gcc programName -o executableName
so according to our example:
gcc hello.c -o hello.exe
- To execute your program from Cygwin UNIX prompt,type in the following:
./hello
Now you can easily use Cygwin to write , compile and run a C program.So if you find this useful, please don't forget to like and share it with others...
Thanks.
Saturday, 4 May 2013
Assembly Language Programming
Want to be a better programmer?? Or your cracking tutorial said to learn Assembbly Language first?? here is a guide for you check my page on programming.
p.s- cracking is only for educational purposes.
“Assembly Language is a low level programming language.”
If you don't understand the meaning of the above statement I strongly suggest you to study about the high level programming languages such as C , java or python(strongly recommend). But if you are good enough you can get the idea quite clearly about the low level language with the introduction I give to you.
Introduction.
Assembly Language is a low level language – this means that it operates from the lower levels of the computer architecture. If we consider the computer in a simple manner, there are two main layers. They are , the hardware layer and the software layer.
- If we take the hardware layer it consists of memory chips, processors and all kinds of electronic stuff. They are all interconnected to the processing and storage of the data we input.
- If we take the software layer it basically the way for us to talk to the hardware of the computer and they give us the output we need. The programs like word processors, calculators and games (my favorite) are in the software layer.
The thing is we have to tell the computer to perform a specific task through a software but the computer can't understand just any language it only understands the machine language. Machine language is a hard-to-understand language consist of 1s and 0s because of this early programmers made a program called the assembler and used it like a converter to convert the instructions of a language called assembly language to machine language instructions. So that's the birth of the Assembly Language.
Why we learn Assembly Language??
- The programs written using it are faster than high level language programs.
- The programs written using it are smaller in size than high level language programs.
- Learning it gives you a better understanding how the programs work.
- Makes you a better programmer.
- Basic for cracking a software protection ( only for educational purposes ).
- Microprocessor programming.
Warnings!!
- Not for beginner programmers.
- Large code even for a simple program.
- Hard to learn.
Tips-
- Use Cygwin software. It is something like the Linux command line in windows.
- Use Vmware virtual machine to run linux on a windows platform use the free version it's enough.
Guide for Beginner in C Programming
C programming language is one of the most popular programming languages. It's best implementation was the Unix OS. The creator of the Unix OS created the C language by improving the B language (this is real and kind of funny) especially for the creation of Unix OS.
Why you should learn C
- Well, most programmers have started programming with C.
- It's a powerful programming language.
- There is no OOP so, programming is less difficult(but OOP is 'cool & powerful' sometimes).
OOP means Object Oriented Programming which is an advanced(not much) programming concept.
Ok , I want to learn C,then what should I do??
First if you are a windows user you should find Visual Studio which is a free compiler software from Microsoft!! . If you are a gamer you probably have it with you. Unix users have their command line compiler gcc
more on this later.................
more on this later.................
Subscribe to:
Posts (Atom)