C :: Program That Lets To Download Torrents On Linux
Mar 22, 2013I want to create a program that lets you download torrents on linux ... how to start ...
View 1 RepliesI want to create a program that lets you download torrents on linux ... how to start ...
View 1 RepliesI want to build a program that can download youtube videos, but I don't know where to start.
I can obviously use IDM to download videos, but I want to learn what goes on in the backend so I can download them manually!
I currently know python, javacript, nodejs, can I use those languages?
I need to write a c program that can receive signals and recognize a certain pattern (SIGUSR1, SIGUSR2, SIGUSR1, SIGUSR2). once the pattern is caught the program terminates itself.
I am able to send the signals to the program from a different process, but I am unsure on how to get the signal handler to recognize the pattern. here is what i have so far:
Code:
#include <signal.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdlib.h>
sig_atomic_t sigusr1_count = 0;
sig_atomic_t sigusr2_count = 0;
[Code] .....
I just need getting the program to be able to catch that specific pattern.
I have written a program which uses a pid to check if the process is currently running and return a value based on the system call result.But the program core dumps
Code:
#include <stdio.h>
#include <string.h
int main( argc, argv )
int argc;
char * argv[];
{
int p_pid = 99;
char buff[1000];
}
[code]....
What is the mistake in this code and is it portable in both unix/linux , is the method secure (grepping for program name )?
I'm writing a program to turn the two commands "gunzip file.tar.gz" then "tar -xvf file.tar" into "x file.tar.gz", but I've ran into a problem I can't find a solution to, here are the outputs I get depending on if I use a gunzip -f flag in my system() call or not:
if I use: (void)system("gunzip ", store );
> x file.tar.gz
gzip: compressed data not read from a terminal. Use -f to force decompression.
type: gzip -h
store 1: file.tar.gz
tar: option requires an argument -- 'f'
[code]....
I don't know if the problem is something to do with my code or something to do with gunzip and if it is to do with gunzip if I can even solve it with my code? I've tried for a while to find more info and read the gunzip man file, ran "gunzip file.tar.gz" outside of my program and found that it works normally producing file.tar so I suspect the problem is related to system()?
I have code that creates an index file created from a data file of records.
#include <iostream>
#include <fstream>
#include <map>
#include <sstream>
#include <string>
#include <iomanip>
using namespace std;
class Record {
[Code]...
I now need to write a second program that allows the user to enter a command on the Linux command line such as
search 12382 prog5.idx
and returns the information for the record with that key. The code I included for the index file is correct and works properly, but how to write the second program.
Here is the index file created by the first program:
8: blank 0 $ 0.00
12165: Item16 30 $ 7.69
12345: Item06 45 $ 14.20
12382: Item09 62 $ 41.37
12434: Item04 21 $ 17.30
16541: Item12 21 $ 9.99
21212: Itme31 19 $ 8.35
34186: Item25 18 $ 17.75
41742: Item14 55 $ 12.36
The top line is a dummy record, the first number is the size of the file.
I am developing a program for a community launcher/downloader. What i am here to ask is there libraries to download a repo through an autoconfig file for downloading and updating the mod...
View 9 Replies View Relatedhow to download and install gcc compiler?
View 4 Replies View Related// This is my actionlink on the index view
@Html.ActionLink("Download File", "Download", new { fileName = Model.OriginalRecordRelativeFilePath })
// This is my file download method at the controller file
public FileResult Download(string fileName)
[Code] ....
I want to get the file named path from C:DataIntergrationInterfacepath. I linked the path with file name. But i get this error System.IO.FileNotFoundException: Could not find file 'C:DataIntergrationInterfacepath when i click the actionlink.
Using the C # programming language LED controller through which controls the array is connected to the controller via the RJ45 port. I already know the basics, I mean specifics, ie
Using the instructions and DLL included with the hardware, I want to read data from it, but I can not deal with it.
Model controller is "C-Power5200" and dll is "CP5200.dll".
I would like to:-pick the data-display-edit and - save in the controller.
To read the data I am using the function
CP5200_Net_Read (BYTE * pBuf, int nSize);
and to save
CP5200_Net_Write (const BYTE * pBuf, int nLength);
Basicly I want to make a c++ program which does the following:
1- logs in to 4shared.com with username 'user_example' and password 'password_example'.
2- uploads to the 4shared account a file named 'test_upload.txt' located in 'C: est'
3- downloads a file named 'test_download.txt' from the 4sared account
I user curl 7.39.0 and curlpp 0.7.3
1- how to keep the same session between successive http requests
2- how to make an http request to upload a file
3- how to get the url of a file with specified name on a 4shared account
My Windows service may download a binary update in the background using WinHTTP APIs. I'm using code similar to the one from the bottom of this MSDN page. For ease of access I'll copy if below:
Code:
DWORD dwSize = 0;
DWORD dwDownloaded = 0;
LPSTR pszOutBuffer;
BOOL bResults = FALSE;
HINTERNET hSession = NULL,
hConnect = NULL,
hRequest = NULL;
[Code] ....
The issue I'm experiencing is that while downloading, the code above "hogs" most of the bandwidth available on the client computer. My goal is to make it "throttle" itself on a configurable "bps" level, say at 50 kbps and not use any more bandwidth.
Someone suggested measuring my current download speed (in bps) and depending on the value make the thread "sleep" before calling WinHttpReadData again.
So the formula I'd use to calculate BPS is this:
BPS = (BytesDownloaded * 1000 * 8) / TimePassedInMilliseconds;
Then to convert to Mbps:
Mbps = BPS / (1024 * 1024);
And the waiting/sleep would be done as such:
Code:
DWORD DesiredBitsPerSec = 50 * 1000;//for 50 kbps
if(fBps > DesiredBitsPerSec) {
DWORD dwW = (DWORD)((fBps - DesiredBitsPerSec) * 1000) / DesiredBitsPerSec;
if(dwW > 0)
::Sleep(dwW);//Sleep to throttle the download speed to the one we need
}
So I implemented it into the code above but it didn't work -- the Sleep API would produce very strange delays. So I decided to add a little bit more tracking code to actually be able to see what BPS values I'm getting.
I created a small test project that is attached to this post to illustrate the issue. (It's hard to explain without running an example.)
For a test I began downloading a large binary file (Windows 10 MSI, off Microsoft's server) and at the same time had the Task Manager open on a Performance tab that was showing me the current network throughput. I made a screenshot:
But as you can see, the reading on the test program and the actual network BPS values differ greatly.
I'm attempting to write a little UDP socket library in c++ on linux so a user can just create a new instance of a UDPSocket class, specify destination ip and port, and just connect. Then the user should be able to call send() or receive() in any order they want.. and here I encounter a little problem..
Most of the tutorials for udp socket sending out there include a bind() call when you create your "server" that is supposed to receive data, but the code that send data does not need one. Because I also want my library to support unicast/broadcast/multicast, I have read that I need to set the socket option SO_REUSEADDR on my sockets (since multiple sockets will need to be connected to same destination IP/port for broadcast/multicast)
My question is.. do I need to create 2 socket handles per "UDPSocke in order to make this work? One for sending and one for receiving data? In my code when I try to work with only 1 socket, it is only able to receive stuff from itself on unicast.. Or should I just remove the SO_REUSEADDR when in unicast mode, then try to bind with both sockets, accept that the bind will only work on the 1st socket, and take it from there?
I have a code that I'd like to debugg it.
Question
1 - What is the correct command line to use the debugger ?
2 - Do I need to install additional software for the debugger ?
if yes what it's name?
I use ububtu 12.4compiling command: gcc abc.c -lpthread -o abc
This is what so far i did
Code:
#include <stdio.h>#include <string.h>
#include <ctype.h>
#include <bsd/string.h>
int
main(void)
[Code] ....
How to do this Using the fork(), execvp() and waitpid() system calls, launches the requested program and waits until the program has finished.
I am an experience C programmer but never implement GUI.
I need to make a demo implementation that will be run on Linux and will implement GUI.
I searched the WEB and found lot of information, among is implementing the GUI in HTML and run the API through web browser.
How can I make such implementation in C?
I want to use two separate files in 1 program, but cannot get it to work. I don't know if it's my files or the compiling thats wrong. I have never used 2 files in my programs so far. Only used #include <stdio.h>.
Here are my files:
extern_static.c Code: extern int i;
int main(void)
{
[Code]....
I have a c file which can be compiled in Linux via GCC , but when I compile it in NetBeans via Cygwin or MinGW , it doesn't work and keeps throwing a segmentation fault.
View 14 Replies View RelatedI have this following piece of code:
int id = 5;
const char *ptrId;
ptrId = ( int_to_str(id) ).getPtr(); // Works in Solaris well
But the above code prints some junk values when I run the same on Linux machine. But the following works well on Linux:
String temp = int_to_str(id);
ptrId = temp.getPtr();
The prototype of getPtr() is:
const char* String::getPtr() const
I want to create command line game in Linux but I don't know to get the key state. I heard of getch() but that stops the program.
View 1 Replies View RelatedI want to open an application A from another application B. By opening it, I don't want to open it within B. I found many ways to call an application from within another. However, what I want to do is open the other one(A) simultaneously. How can I achieve this? fork() and exec() seem to open A within B. I am developing a code for Linux and Mac.
View 7 Replies View RelatedWhy is using namespace needed in linux but not in turbo c++?
View 1 Replies View RelatedI have implemented MD5 checksum algorithm by using C language, but it is resulting correct value in windows but not in Linux?
// Constants are the integer part of the sines of integers (in radians) * 2^32.
const uint32_t k[64] = {
0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee ,
0xf57c0faf, 0x4787c62a, 0xa8304613, 0xfd469501 ,
0x698098d8, 0x8b44f7af, 0xffff5bb1, 0x895cd7be ,
0x6b901122, 0xfd987193, 0xa679438e, 0x49b40821 ,
[Code] .....
I'm trying to implement this on ubuntu, to compile and run only under ubuntu.
I found 100s of other attempts at answering the general question of arrow key press in c++. Nothing solid.
Some recommend using the Readline for the functionality I am trying to implement, but I need to stay clear of GNU licences if I can for this project. And some tips only work on projects for windows machines... for example the conio library.
For linux there may be the option of using the ncurses library which I will take a look at, but I am stubborn and want to implement this myself. It should be an easy straight forward thing to do, which is why I am a bit frustrated at the moment.
Here is my test code so far.
#include <iostream>
#include <sstream>
#include <stdio.h>
#include <string.h>
#include <termios.h>
#include <unistd.h>
using namespace std;
int main(void) {
char a;
stringstream ss;
string s;
[Code] ....
So! This works... 80% of the problem is solved. If you compile this, g++ under linux, ubuntu in my case, and run. Each keystroke reveals the correct key numbers.
q=113
w=119
when I click on the up key I get,
up = 279165
I thought, I can use this number is a if(int == '279165') to detect the up key.
I was not so lucky... this int is not behaving like an int!
So I modified the code to see it I could carry out an int operation on this number.
I added a 100000 to int i.
cout<< i + 100000;
Code:
#include <iostream>
#include <sstream>
#include <stdio.h>
#include <string.h>
#include <termios.h>
#include <unistd.h>
using namespace std;
int main(void) {
char a;
stringstream ss;
string s;
[Code] .....
Compiling and running this, and pressing the UP key gives the following number.
100027100091100065
Some some sort of array, something like, [27][91][65].
I tried all ways to access these individual numbers, actually the third one for comparison purposes, but no luck.
For completeness sake I list the other arrows.
UP = [27][91][65]
DOWN = [27][91][66]
LEFT = [27][91][68]
RIGHT = [27][91][67]
A little further digging shows that these numbers are derived from the representation of a "multi-char" constant, the data type given when pressing special characters...
Now here is the main problem I have, I can find ANY decent documentation on how to handle and play with "multi-char" .
I'm trying to build a Linux Process Scheduler from scratch but dont know where to start.
View 1 Replies View RelatedI'm new in IPC. I would like to implement a signal of a new message, which calls the slot function, eg .:
Code:
msg_on_newMessange(type, &slotFunction);
My code:
Header file: messages.h
Parent file: parent.c
Child file: child.c
How can I do this ?