Hi,
I'm practicing C programming for Linux for an exam.
I don't know how to exit the program when user press Ctrl + a ( not Ctrl+c )
For example, looping something until user press Ctrl+a
Could anyone tell me how to check Ctrl+a input?
Notes: I'm using 'gcc' and run output with './a.out'
Thanks in advance for everyone!
...
Hi,
I'm using a open-source library for i2c bus actions. This library frequently uses a function to obtain an actual time-stamp with millisecond resolution.
Example Call:
nowtime = timer_nowtime();
while ((i2c_CheckBit(dev) == true) && ((timer_nowtime() - nowtime) < I2C_TIMEOUT));
The application using this i2c library uses a lot o...
Is there a command to tell compiz that we want to bring in front and set focus to a specific window?
How should we identify the window in that command?
The reason behind this question is the following use-case:
Suppose we have a wiki to keep notes of anything interesting we find out. It would be very convenient to have a keyboard short...
On linux (ubuntu), is it possible to execute a script upon any incoming network connection?
During long periods inactivity on my home server, I plan on stopping the software raid, parking the data disks and restarting the raid array upon encountering an incoming network connection.
I've been researching this problem and haven't come a...
Basically I have a m file which looks like
function Z=myfunc()
% do some calculations
dlmwrite('result.out',Z,',');
end
What I want is just execute it from command line without getting into Matlab. I tried several options (-nodisplay -nodesktop -nojvm -r ....), none of them worked. I end up getting into Matlab and have to type "qui...
Hi everyone,
I can't figure out how to display something (like hello world) in every 3 seconds.
I'm writing in only C programming with gcc compiler in linux.
We can stop it by Ctrl+c.
I just want simplest and easiest way to manipulate thet code with my project.
Thank you so much in advance!
...
Following is the final code I was working on. I can sleep and show again other messages with sleep() but I can't print what I originally wanted which is inside 2nd while loop. As far as I tested, while((ptr=getutent()) != NULL) would be the problem but I don't know how to solve. I would really appreciate if anyone can help me. Thanks
No...
See an example here: http://mattpotts.com/portal/
I put an includeme.htm in each directory on the required path to find the point of failure. It works fine on my local machine (windows) with the same directory structure but fails on my remote (linux) server.
Directory structure:
+-firefli/ drwx--x--x
+-private_html/ ...
I'm working on an embedded C++ application running on Linux. I've recently encountered some really strange performance problems with pthreads.
My system has 8 threads passing information back and forth protected using a pthread mutex lock. When running my application stand-alone, thread performance is abysmally slow when taking a mute...
I wonder if there are some API to get the current process' command line arguments on Linux.
I guess I was terribly unclear. The real purpose of the question was about passing unicode file names through command line arguments.
...
Im using a market data source implementation that contains .so.0 files. However these are 'soft links' to actual .so.0.0.0 files. Why is this done?
When I try to copy these .so.0 links, it ends up copying an exact replica of the .so.0.0.0 file but with a .so.0 prefix.
Added comment:
so I have a libfoo.so file, and it is being access...
Hey there !
I'm trying to automate a proces which I have to do over and over again in which I have to parse the output from a shell function, look for 5 different things, and then put them on a file
I know I can match patterns with grep however I don't know how to store the result on a variable so I can use it after :(
I also have to p...
How do I write a script to determine if a file is older than 30 minutes in /bin/sh?
Unfortunately does not stat exist in the system. It is an old Unix system, http://en.wikipedia.org/wiki/Interactive_Unix
Perl is unfortunately not installed on the system and the customer does not want to install it, and nothing else either.
...
I am working in php on ubuntu. When I use any image on web page which has denied access, there is warning on page. I want to check it before displaying and if it does not have rights to open then give it access to open. As we do in terminal command.
chmod 777 myimage.jpg
How to check this and give full access to a file in php.
Thanks...
When we invoke system call in linux like 'open' or stdio function like 'fopen' we must provide a 'const char * filename'. My question is what is the encoding used here? It's utf-8 or ascii or iso8859-x? Does it depend on the system or environment setting?
I know in MS Windows there is a _wopen which accept utf-16.
...
After deleting the partitions from a USB stick and then re-inserting the disk I see the following from dmesg:
[99341.658055] sd 4:0:0:0: [sdb] 15771720 512-byte logical blocks: (8.07 GB/7.52 GiB)
[99341.658670] sd 4:0:0:0: [sdb] Write Protect is off
[99341.658678] sd 4:0:0:0: [sdb] Mode Sense: 00 00 00 00
[99341.658684] sd 4:0:0:0: [sdb...
When reading/writing a file in my application, I want to exit(1) if the file is not closed correctly. On Windows it works well, but on Linux this error appears:
‘exit’ was not declared in this scope
How can I solve that?
Thanks.
...
I have been a Windows/M$ boy now for over 15 years and specialisted in web design for 10 years of that using Classic ASP and ASP.net. Trouble is all the latest funky languages that I want to play with (Django using Python, Rails, NitroJS) are *nix based and often run off Macs and all use Apache not a sniff of a IIS port/version.
I've pl...
I'm porting a windows network application to linux and faced a timeout problem with select call on linux. The following function blocks for the entire timeout value and returns while I checked with a packet sniffer that client has already sent the data.
int recvTimeOutTCP( SOCKET socket, long sec, long usec )
{
struct timeval timeout;...
I want to rewrite the "cp" command of Linux. So this program will work like #./a.out originalfile copiedfile. I can open the file, create new file but can't write the new file. Nothing is written. What could be the reason?
The current C code is:
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include...