Skip to content
Advertisement

Tag: c++

How to create hard link in Linux from a C program

We know we can create hard link in Linux using ln file1 file2 which will make file2 a hard link of file1. However when I try to do this by using a C program, I face issues. Below is the C code. After compiling this program with gcc I run it as below. Here file1 exists and file2 is the

How do I create a file in FUSE in C?

For an assignment we have to build a FUSE file system using C. I am trying to create an empty file in the mountpoint directory that I have mounted when I start fuse but it’s not working. I tried placing the following inside my own implementation of the fuse init function: After I had done that, what happened when I

Linux Socket Bad File Descriptor

I couldn’t find a duplicate, so I decided to post. We’re getting into Sockets (beginner-level) now, and was given the code below to make the client send a simple message to the server by using send() and recv(). However, everything I have tried doesn’t seem to get rid of the error: Bad File Descriptor and newsockfd always returns the value

Can’t compile C++ program on Ubuntu

I used OSX to program in C++, but I am new to C++ compiler on Linux. I have a program consisting two .cpp files and one .h file that are compiled and run successfully on my Mac, but get compiling errors on Ubuntu. I did install gcc and g++ compilers and build-essential, and also apt-get update and update, searched online,

Multiple instances of main method in C

I’ve got an issue with an assignment, but I’m not asking for help to do the assignment, just single problem. My code is like this: Here’s the problem: When I do the make command from the directory, I get the error What does this error mean? I only defined the main method one time in my own file Answer The

C assembler function casting

I came across this piece of code (for the whole program see this page, see the program named “srop.c”). My question is regarding how func is used in the main method. I have only kept the code which I thought could be related. It is the line *ret = (int)func +4; that confuses me. There are three questions I have

Advertisement