C program to find file properties using stat() function

Stat Linux

Stat() function in C is used to retrieve information about the file by accepting the filepath as an argument to it. Stat() function can help us to extract following information about any file using C program. File type and mode Number of hard links from the file User ID of file owner Group ID of … Read more

Functions in C

Function in C programming is a group of statements which are separated from main task for the purpose of calling it repeatedly, as and when required. A function normally does a predefined task and returns the result of operations to the statement from where this function is called. Functions greatly help to simplify the main … Read more

How executable is created during compilation on Linux ?

This code is tested on Ubuntu . You may need to twick the script if you use a different Linux version. The steps for compilation as as below, write a source code helloworld.c run a preprocessor which create helloworld.i run a compiler which creates helloworld.s by taking preprocessed file helloworld.i as input. run a assembler which … Read more

How to resolve error : ” no buildable Go source files in “

Sometimes when we try to compile an unknown go package, we can see an error like “no buildable Go source files in”, the possible solution could be, Check if the package which shows error “no buildable Go source files in” is using C code, like in the source file, in that case, we might see … Read more

How to execute C code from go – c to golang binding ?

// If a Go source file imports “C”, it is using cgo. The Go file will have access to anything appearing in the comment immediately preceding the line import “C”, and will be linked against all other cgo comments in other Go files, and all C files included in the build process. note here: there … Read more

How to Switch between Multiple Java Versions in Linux ?

If you have installed multiple JDK on ubuntu and sometimes you might need to change the version of installed JAVA to get few things working with one version and few other things working with another version of JAVA. Lets first identify which all JDK are installed on your Ubuntu, this can be done using “update-java-alternatives … Read more

How to call Assembly function from C code ?

In this post, we use ARM are reference architecture for writing the assembly code but the basic way of accessing functions defined in assembly program from C should remain almost similar ( except instructions ) for other architectures. Q. Write a C program helloworld.c which would call a function “simpleAdd” defined in assembly code ? … Read more

How to implement linked list in C programming ?

This programs shows a simple way to implement singly link list ( Singly link list is the list which can be traversed only in one direction i.e. forward till end ) The above program is self explanatory which initialises the head element of the linked list, adds more nodes into the linked list, and at … Read more

How to implement stack in C programming ?

In continuation of demonstrating simple implementation of data structures, as we shown in our last post “How to implement linked list in C programming ?”, in this post we will show how you can implement simple stack in C programming language. Stack is nothing but a one this kept on another, where we define how … Read more

Byte Array To Integer And Integer to Byte Array Conversion using JAVA

If you are working in some network related data transfer like sending some commands over socket, then its high likely that you will need to convert your integer command number to byte array before sending over socket since data sent over socket is only byte arrays. Following program briefs above how you can convert Byte … Read more