I want to write a unit test that checks that two file paths are equivalent, but I don’t want to assume that the string representation is the same. For example, on Linux there could be symlinks in the path in one case and not in the other. On Windows, there could be drive notation on one (X:foo) and network notation
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
C program works on my Ubuntu VM terminal but not on school Linux server?
I have this C program that runs perfectly on my Ubuntu Virtual Machine but does not run at all(doesn’t prompt user for input, just finishes) on the school Linux server. School Linux version: Linux 2.6.18-371.9.1.e15 x86_64 My Ubuntu VM version: Linux 3.16.0-33-generic x86_64 Here is the program: Any idea why this is?? P.S. thanks to those who helped me with
Run an executable from Ubuntu to Debian
I have a project in C++, but my data is just too big for my computer. So, I tried to build my project in a desktop in our lab, but the compiler is too old (4.3.5 and I had 4.8.1 when I developed my code). I do not have the rights to upgrade and the people that do have the
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
make[2]: *** No rule to make target `/usr/lib/i386-linux-gnu/libmpfr.so’ in CGAL
I am using CGAL and I have this minimal example (which should be fine since it’s an example): However, I am getting this error: What I should do? I am creating the CmakeLists files like this: as I describe here. If you need more information, please let me know. — Answer The easiest way to install CGAL on Debian or
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