Programming :: Getting TTY Id From A C Program

May 23, 2009

I am new to linux/c programming and I am trying to get TTY id from my c program. Something like this:

int TTYID = get_ttyid();

How do I do that?

View 1 Replies


ADVERTISEMENT

Programming :: Program A SH - Bash Program With Zenity To Play Radio Based On A Site?

Feb 15, 2011

I will have to code this. However I am lacking of time since I have too much to do. make a short code bash/dash to prompt the country with Zenity, then, get the PLS or m3u url and prompt with another zenity which radio to play. http://www.listenlive.eu/index.html

My code to get url's radio country.htm is:

Code:

View 2 Replies View Related

Programming :: Open Or Run A File/program Through A C++ Program

Jan 15, 2010

Ok so Basically i have 2 questions

1. i know how to create a file with c++ using but is there a way to save it to a specific location on your computer with windows and linux

Code:

2. i need to know how to run/execute/open a file in a c++ program im using and its not working

Code:

View 4 Replies View Related

Programming :: Build A Simple Program For C Programming Class?

Feb 12, 2011

im trying to build a simple program for my C programming class, this is the source code

#include <stdio.h>
int main()
{
int length, width, length, height, area, perimeter;
perimeter = width + length + height;
area = width * length + heigth;

[Code]...

i dont see any error (you might)but every time i run it it runs but after it asks me to input for the width i do it but it doesn't take me to the length, it just stays blank until i input another value in the same place for the width, it asks me for 4 inputs in total i don;t know why, and after i run it different times it gives me different values for the perimeter and are. how can I fix this?

View 5 Replies View Related

Programming :: Gcc And Pow In A C Program?

Feb 5, 2009

I found some interesting behavior when discussing the pow function from Math.h with someone. I am well aware of the need to compile with the -lm flag, but to my surprise this actually isn't necessary if the arguments to the pow function are literals. For example, this program compiles in gcc without using -lm:

Code:

#include <stdio.h>
#include <math.h>
int main()

[code]....

If I try to change the call to any of these:

Code:

double bCubed = pow(2.0, e);

Code:

double bCubed = pow(b, 3.0);

Code:

double bCubed = pow(b, e);

Then the -lm option is required or else it can't compile. So does anyone know why it's necessary to use -lm when the argument(s) is/are variable(s) but it works fine if both arguments are literal values? As a side note, any of the above compile with g++ however. Also, if it helps, this is the version of gcc I'm using:

gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-44)

This doesn't happen on my Mac however that is running: i686-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5484)

View 3 Replies View Related

Programming :: Error In My C++ Program ?

Mar 15, 2011

The following is the error in my program :

Here is my program...

View 7 Replies View Related

Programming :: Autorun Program In C++

Mar 10, 2010

With what functions i can write my program in /etc/init.d with c++ to start every time the computer starts ? (like in windows with RegOpenKey,RegSetValueEx..............) ?

View 4 Replies View Related

Programming :: C Program To Get Cpu Utilization?

Feb 26, 2010

language:cOs: ubuntuI have googled for a c program to get cpu utilization factor from 2 days.We can get it through "top", "who" commands..But I hav not found any API or a program.

View 5 Replies View Related

Programming :: Chat Program In C

Aug 17, 2010

Am new to this community and this is my first post. am doing a project where i have to develop a wireless ad hoc routing protocol. I have just begun working on the project. I did not know where to start, so started off with a simple chat program using TCP and thought of making the modifications to it later on. But I do have a prob even i running that!

Am not getting the messages in a synchronized manner. The prog is running fine, but the messages that i type from the server are not reaching the client at all, and at times some garbage values are getting printed(When the strcmp()fn returns 1, "connection terminated" gets printed timely in both the sides. this is the oly situation where i do not get garbage values.) am using VC++ 6.0 here.I have been breaking my head for the past 3-4 days for this simple issue. any response to this would be of great help.

View 14 Replies View Related

Programming :: How To Use __attribute In My Program

Nov 22, 2010

I have checked following two pagesand this page also In following program I want to use attribute keyword of C and format string as printf

Code:
#include<stdio.h>
int myfunction (int ,int);

[code]....

View 1 Replies View Related

Programming :: Make A GUI Program From C?

Jun 30, 2010

I want to know how can I make a GUI program from a shell program I coded in C a long time ago. Can anybody point me to good tutorials?

View 4 Replies View Related

Programming :: How To Program Effectively

Jan 29, 2011

I'm new to programming under linux (not new to programming). Before that I have written c++ codes in Visual Studio under windows for some years. I read some tutorials and learned editing codes with vim and compile codes with g++ or make tool. And I tried gdb.

But I think compared to my coding experience in Visual Studio, these steps are very ineffective. With VS, after I wrote codes, I just press ctrl+f7 to compile and ctrl+f5 to run the codes. If I want to debug, press f5, and I can see every variable in a 'watch' window.

Under linux, after I write codes, I need to quit vim, type make to compile. If I have some mistakes, I have to remember the line numbers and re-open vim to check the errors. And I think debugging with gdb is so hard.

I think as a newbie to programming under linux, maybe I haven't find the right tools. Or programming under linux is just so hard so a programmer who can overcame these could be strong enough to do programming without some IDE tools?

View 8 Replies View Related

Programming :: How To Start Program

Dec 20, 2010

I want to make alarm(buzzer) and Lamp(led) to work from infrared sensor output via usb.When ir sensor detect motion it will make the alarm&lamp on. Then also sending mail. Im using pic 18f2550-1/sp(usb Fsio from km2.net).But i dont know how to start the program.

View 2 Replies View Related

Programming :: Use G++ To Compile QT Program?

Dec 26, 2010

My Fedora 14 have installed gcc-4.5.1-4.fc14.x86_64,qt-4.7.1-5.fc14.x86_64,
I don't know how to use g++ to compile QT program.
Do I need to set PATH or something else?

View 5 Replies View Related

Programming :: Write A Program (in C)?

Feb 26, 2010

I want to write a program (in C), which does 4 or 6 simultaneous calculation. Is there away of doing something like:

do at the same time{
Core 1 do:
this_thing_1

[code]....

View 3 Replies View Related

Programming :: Output Of The C Program?

Jun 8, 2009

See the first program below :

Code:

This code when compiled gives the following errors:

1. conflicting types for 'fun' at line no: 9

2. previous declaration of 'fun' was here at line no: 3

Why is this happening?

If i modify the above program as shown in the second program below:

Code:

This code when compiled gives no errors.

Why the difference occurs between the first and second program?

View 8 Replies View Related

Programming :: MultiThreaded Program In C++?

Oct 23, 2010

I have a program called "Device Manager" to manange usb tokens for sending and recieving
multiple data to/from them using shared memory method.Here is a piece of "Device Manager" code:

Code:
int main()
{

[code]...

View 3 Replies View Related

Programming :: Build A Spi Program Using C++?

Jan 19, 2011

I'm trying to build a spi program using c++. I'm able to perform half-duplex transfers using the read/write functions, it works perfectly. Now I need to perform a full-duplex transfer, but I'm facing some problems. When I try to receive more than one byte, the slave returns to me only one byte.Ex: I send: FF FF FF FF FF The slave must return: 03 02 00 13 04 But what is happening is:

1st Transfer:

tx: FF FF FF FF FF
rx: 03 00 00 00 00

2nd Transfer:

tx: FF FF FF FF FF
rx: 02 00 00 00 00

[code].....

View 3 Replies View Related

Programming :: Compile A Program With Gtkmozembed?

Apr 21, 2010

i am not able to compile my test program which uses gtkmozembed.As i am very new to this, i dont know which are the packages to be installed and how to compile

[Code]...

View 1 Replies View Related

Programming :: How To Use Cryptographic Techniques In C Program

Jun 23, 2010

i have a simple client and sever program in C language. in which client is requesting some parameters( like system up time, memory, no of process etc) form server and server send this information to client.now i want to use DES, AES.RSA. BLOW FISH algorithm to this communication to make it secure. actually i have to compare performance parameters of these cryptographic techniques.but i don't know how to use SSL libraries as SSL library support these cryptographic techniques. but i have no idea how it will work for me

View 4 Replies View Related

Programming :: C/C++ - Program Detecting New Sockets

Jul 25, 2010

I need to create a C/C++ program in Linux that succeeds in detecting how many tcp-sockets and what tcp-sockets are created by the other processes in the system in a particular time interval (e.g., the interval time this application is running in). Then, I'd need to get some information like local/remote port number and local/remote ip address of each of these sockets.

View 8 Replies View Related

Programming :: Created First Little Program In C++ That Im Happy About?

Sep 4, 2010

Code: //Author: Donald Farkas
//Created: Sep/4/2010
#include <iostream>

[code].....

View 6 Replies View Related

Programming :: Managing Instances Of A Program?

Mar 23, 2011

I finished a program that connects to a remote server and does some stuff there for a while. What I want to do is to run several instances of the program to have different connections at the same time, and to be able to manage those processes automatically (for example, if the connection stops, detect it and reconect).

I guess I will have to use the pid of the processes and handle them somehow but I dont really know what to do because I haven't used c++ in a while and I never went that deep. All this will be running in suse, debian and/or yellowdog distros Maybe there's a tutorial or you guys know some tool that i can use,

View 3 Replies View Related

Programming :: Program To Use Grep W/regex?

Jun 1, 2011

I'm just starting out with bash scripting (yesterday, really). I want to add a file to each user's home directory, pretty simple really, and send it out via our Apple Remote Desktop system to our Macs. Here is my script: Code: #!/bin/bash

for i in $(ls -d /Users/*)
doif [ -e $i/.tcshrc ]
thenecho "$i/.tcshrc exists!"elseecho "$i/.tcshrc does not exist"

[code]....

View 6 Replies View Related

Programming :: Convert Awk Alternative In C Program?

Jan 14, 2010

I wrote a bash script a few months ago and now I want to convert it to a C program. However, i used awk a lot in my script, and I don't know what to use in place of awk. The awk calls are simple, like string splitting and math, but I don't know of any replacement for the string splitting function. Are there any C libraries that include some sort of string splitting function?

View 4 Replies View Related

Programming :: C Program In Unix Environment?

Jan 12, 2011

my instructor gave me a project in c programming language, the probelem i don't have a c program combiler and i don't have a unix os on my computer, and my knowledge in c program is soo weak i took it years ago, i have this code but it does't compile on Dev-C++ on Windows OS, so if you just help me out with this program:

#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>

[code]....

View 5 Replies View Related

Programming :: Use Hostname (a URL) In Socket Program?

Aug 2, 2010

I don't have the IP address & Port of the server but I know the hostname (URL) to establish a connection.How can I use it to get connected to the particular host?

View 4 Replies View Related

Programming :: How To Compile Program For Windows

Feb 10, 2010

I have a c program and its related libraries for Linux. But, I need a EXE file to run in windows.

please let me know how to compile the program for windows

View 8 Replies View Related

Programming :: Test Program To Get The CPU Utilisation

Mar 9, 2010

I wrote a test program to get the CPU utilisation. I hope to extend it to take cpu utilisation on multi core machines. Hear I used the equation for taking cpu utilisation given at [url] of JmSchanck post. But when I match the output of my program against 'top' and 'system monitor' output it seems quite high. Sometimes cpu utilisation goes more than 100%.

So the given equation in that url is correct? can anyone give me the equation to take CPU utilisation?

Code:

View 3 Replies View Related

Programming :: Disk Overwrite Program In C

Feb 17, 2010

I have to shred a disk from a custom program. Now I open the disk (/dev/sdaX) from a C program and write /dev/urandom to it. But, most of the time the disk is being used by other programs. At least a 5-10 programs will have files opened on that disk. I cannot kill all the programs as some of them are critical. (Now, don't ask me why I am trying to overwrite a disk which is live and being used by some critical programs. Some moron designed it that way and gave me to implement). Sooner or later, write to /dev/sdaX will fail.

Is there any way (may be some flags that I can pass to open while opening a disk for writing) that I can use so that my overwrite continues even if other program is using the disk? (I am not bothered about what will the other program read and process from the disk when this happens)

View 6 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved