Programming :: File/directory Operations In C?
May 5, 2010How do you do things like list directory contents, mov/copy files, make directoriestc. in C?
View 1 RepliesHow do you do things like list directory contents, mov/copy files, make directoriestc. in C?
View 1 RepliesI need to do mount/umount operations in my c program. But my program can only be run under normal user. However, the user who run my program have sudo priviledges to do mount/umount operations. How can i apply the sudo privileges in the mount(2) system call?
View 6 Replies View RelatedSometimes while using Open Office, trying to open a file the dialog box takes 15 to 30 seconds of spinning balls until it shows me anything. Then changing a directory takes another 15 to 30 seconds. Visual feedback on selections take several seconds, and often I find myself a couple of subdirectories down from where I wanted to go due to caching of unacknowledged clicks.
My system is usually very, very fast, as one would expect from the specs. This problem happened, well, almost all the time with kernel 2.6.32-21-generic, now it just started happening again with 2.6.32-22-generic.During these slowdowns, opening Dolphin reveals the same problem, exceedingly slow response. While this is happening, top shows the system is not busy, and the hard disk light is not flashing. Idle is over 90% and user and sys are basically nothing. The system is basically doing nothing while making me wait.
Whenever I move files from a USB memory stick or external hard drive or any other such device the file only seems to transfer 99% of the data and often during moving file operations will freeze and an offer of 'force quit' will come up (although file operations will eventually vanish with the 99% of the file being moved).
Can anything be done to rectify problems with file operations?
how to perform floating point operations in kernel? i answered that its impossible to perform floating point operations in kernel.but he is telling that its possible but with some feature to be added.can any body know about this perfectly??
View 1 Replies View RelatedI am not able to execute a multiple sed statement using pipe filters in a variable. i am trying to extract a path from a file and then working on that path to change a few letters within the path by going through another sed statement.
the code looks like this code...
i just installed the ubuntu-netbook package to test out unity on my system.. on seems to work fine but how do i copy my files and folders to a usb drive ? wen i open files and folders using unity..it jus opens in a black window.. i cannot right click on any item..i can just open it.. how how do i do my normal file operations using it ?
View 1 Replies View RelatedI would like to document my activity on linux terminal during some operation.I want to have text file which will contain all commands typed and output from those commands in a file.I know how to set this option in Putty but I have some problems in linux terminal.
<pre>
bash | tee output.log
</pre>
When I perform above spell, it only records STDOUT to file.on't have there STDIN,STDERRHow to have in this output.log file STDIN,STDOUT,STDERR
i have written block driver. its got registered succesfully.now i want to perform file opration like opening file reading/writing data into file which is stored into device.fter registration device node is created under /dev/xxx i am not getting, through this node how to open file which is stored in device.from one document i came to know that i have to use filesystem but in that doc how to use filesystem is not explained
View 4 Replies View RelatedWe all know linux kernel base layer is made up of structures, in which every object of kernel is well defined. Structure members correspond to object properties required to define object behavior.
For example if we take case of File system.It composed of four objects , superblock objects, inode objects, file objects and dentry object.Each having well defined structure which is being operated by system call handler and by system call service routine in the kernel mode.
Now my question is even in kernel mode we do not have some mechanism by which we can get access to pointer of these structures.We have some macro.
If I want to manipulate structure on my on way, or performing some more operation defined by me.For example after the crash of Hard Disk Drive, having ext2/3 file system, If i want to know all the inode pointers, and block details.
Can I have some way out to do desired operation ??
mechanism to operate on these base label structures, even in kernel mode ..
I installed OpenCV and am trying the example programs. When I try to compile like in the tutorial it is not finding highgui.h.I have 64 bit Mint if that helps at all
View 3 Replies View RelatedI am running after compiling a program and I find that I get the following. How best can I avoid this as i cannot run the program. I have tried removing the offending package, although I cannot find it. I have also tried re-installing. I have also tried changing FC and F90 flags to avoid the MPI version.
error while loading shared libraries: libmpi_f90.so.0: cannot open shared object file: No such file or directory
Initially I thought - use a for loop with ls in it:
Code:
However this causes lots of problems (folders have extensions, I have duplicate folders, the names with spaces create a folder for each element of the name).
The contents of the folder is basically movies (some with subtitles). Some of the names have things like (original) or CD1 CD2 in them.
Ok so I'm running Mint (not full Ubuntu), and I'm not sure if this is a problem with the FS, Kernel, what not.I'm running Linux Mint 9 - x64 - kernel 2.6.35.14 - and when I did a large file copy operation (9GB) it froze up my system until the copy operation was done. I couldn't even use Pidgin, Mozilla, or anything, when trying to open up another Terminal it froze as well.
View 1 Replies View RelatedI'm having this problem wherein the ppp program is altering the /etc/resolv.conf file when connecting.This, despite me having set file permissions to read-only. What could be the problem here?
View 9 Replies View RelatedHow can I track IPsec module's operations? Can I find such a log file or entries in Linux?
View 1 Replies View RelatedWhen I hardcode abc.bin to inputFileName - I can open the file in cpp. But when I pass the same using an optional argument, it fails. Note that in both cases, fprintf, prints the inputFileName as abc.bin properly.
I get can't open - no file or directory.
Code: main()
{
char * inputFileName;
char * optarg;
inputFileName = optarg; //doesn't work.
[Code].....
I have a Toshiba laptop that seems to be freezing on extended operations involving the file system/hard drive. (that's kind of a guess on my part). The system has frozen during the last day or two when I:
- try a large file operation with Nautilus
- try exporting a large video file from Kdenlive
- try formatting the disk for a new install of Maverick (I decided that with the new version almost out, I might try upgrading in case I broke my system)
What I see is the screen freezing and the mouse does not move. As I said, I tried installing the Maverick RC from the Alternate CD (I wanted to do a minimal install). The install hung on the partitioning step and the caps-lock key started blinking (though I don't get this in other cases). I have booted into my Lucid live-cd and a Puppy live-cd to try Gparted, with the same results - the system freezes (but the caps-lock key doesn't blink). Puppy HAS performed better generally, for example I was able to complete my large file operation (backing things up!) but it is freezing on the partitioning step.
I’m new to C programming so I wrote the following program to see if everything I needed to write programs with GCC and the standard C library was already installed. I am having issues in OS 10.10.5, where I am unable to build and compile some simple code, either using Xcode or Sublime text. I decided to install Linux Mint in Virtual Box to see if it would work.
Code: Select all#include <stdio.h>
void main()
{
printf("Hello! This is my first C program with Linux Mint
");
}
For some reason, I'm getting the following error:
mint@mint-VirtualBox ~/Desktop $ gcc hello.c -o hello1
hello.c:2:19: fatal error: stdio.h: No such file or directory
#include <stdio.h>
[code]...
gcc kk.c : kk.c:1: fatal error: gtk/gtk.h: No such file or directory compilation terminated.
View 1 Replies View RelatedI recently switched to ubuntu, so kinda new to it. I installed g++ by
Code:
sudo apt-get install build-essential
and now when i'm trying to compile this:
[code]....
I'm trying to backup every night a big directory (~2.5Gb) using tar+gzip.I'm calling tar like this:nice -n 19 tar --ignore-failed-read --exclude-tag-all=.kein-backup -Pczpsf '/backup/20100925233802f/archive.tar.gz' '/srv/products'And in 90% of the cases works just fine, in about 20 minutes is everything done. However, if it happens that in those minutes one file or folder from '/srv/products' gets deleted it reports me the following error:tar: /srv/products/prod14564.gif: Cannot stat: No such file or directorytar: Exiting with failure status due to previous errorsDoes it exist a parameter for tar to ignore this kind of errors? Is it there any other way to avoid these errors
View 3 Replies View RelatedI'm trying to compile a project, but I receive the following error:
Code: Select allIn file included from monitor/gfx/field.h:14,
from monitor/gfx/termapi.h:18,
from monitor/gfx/termapi.cpp:16:
monitor/gfx/glfont.h:8:31: error: GL/gl.h: No such file or directory
monitor/gfx/glfont.h:9:33: error: GL/glu.h: No such file or directory
monitor/gfx/termapi.cpp:20:30: error: GL/glx.h: No such file or directory
[code]...
I don't know what to do to get pass this.
I have a directory called /data In this directory I have some files like abcejb.jar,12_ab_ejb.jar, shejb.jar, test I need a shell script like... 1st I want to check if there is any ejb file exists in the directory using some condition If ejb files exists I want to redirect the ejb files list to a file called list. Now I want to copy all the files in the list file to some remote system.
View 1 Replies View Relatedi was trying to Compile my c++ program..cme across this problem....but my c programs are getting compilied without any problem.I am using fedora 14. Below is the way terminal reacted to my program..
gcc prog1.cpp gcc: error trying to exec 'cc1plus': execvp: No such file or directory
In my project iam using timerfd.h file info. I included it header file, Iam using "arm-none-linux-gnueabi-gcc" compiler. This file exists in "arm-2010q1/arm-none-linux-gnueabi/libc/usr/include/sys". When i try to execute the program iam getting error: sys/timerfd.h: No such file or directory. remaining files able to find from the same location(sys/time.h, sys/ioctl.h,sys/socket.h).
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <signal.h>
[Code].....
Using a shell script....In a particular directory if we are adding one or more files i should get a mail to my mail id , every time when the new file is added i should get the mail.Using crontab so that it will execute automatically wen any new files are added.
View 3 Replies View RelatedI am new to programming but I am a quick study. I have this script working.
#!/usr/bin/perl
@info=stat("/share/") or die "Can't stat share $!";
while (1) {
[code]...
I have installed QT on Slackware 13.37 x64 and when I create gui project it works ok, but I need OpenGL.When I add #include <QGLWidget>I get error No such file or directory there is my env
Quote:
CPLUS_INCLUDE_PATH=/usr/lib/qt/include
MANPATH=/usr/local/man:/usr/man:/usr/lib/java/man:/usr/share/texmf/man
KDE_MULTIHEAD=false
HZ=100
[code].....
Im looking to use PHP to list a directory. When I click on a filename, I'd like it to automatically remove the first 16 characters off of the filename and save it to the filesystem.
View 6 Replies View Related