C++ :: Sharing A Program - Sending Executable Files

May 22, 2013

I am just wondering if it is possible to send a project to someone via email - In a simple way, almost like you would install software from the internet, maybe a setup file, or something. The compiler I use "Dev C++" creates a .cpp file and an executable. Unfortunately, I cannot send that .exe file. How would you recommend sharing a program?

View 5 Replies


ADVERTISEMENT

C++ :: Sending Dynamic Allocated 2D Array Over Named Pipe Between 2 Executable

Oct 6, 2014

Im writing a scientific software where I like to sent a 2D array (5x4) over a named pipe from a server to a client. When im sending a static array (i.e., double res[5][4];), all goes fine and it works perfect, but when I allocate a dynamic array, it provides some nonsense numbers at the client side. I feel it might be caused because I point to a memory that cannot be shared through a pipe. Am I right and how can I pass the dynamic allocated array itself over the pipe.

//Server program

// Create a pipe to send/receive data
HANDLE pipe = CreateNamedPipe(
"\.pipemy_pipe", // name of the pipe
PIPE_ACCESS_DUPLEX, // 2-way pipe -- send and read
PIPE_TYPE_BYTE, // send data as a byte stream
1, // only allow 1 instance of this pipe
0, // no outbound buffer

[Code] .....

View 2 Replies View Related

C++ :: Sharing Data Between 2 Files

Aug 30, 2013

The problem is I have a function which sets some variables and I want to access the variables, but myfunc() is nested too deeply for me to pass a data structure all the way down and to return all the way up. The functions reside in different files. I'm not allowed to use extern structs (i.e. a global variable).

How to use a class and instantiate it in myfunc(). My solutions are:

- using the singleton class method
- static variables and function residing in the class (but I'm suspicious of this way. seems like it's just class variables masquerading as global variables.

View 2 Replies View Related

C++ :: Parse Executable Files - Registering Types To Be Used At Runtime

Jul 30, 2014

I'm writing a program that needs to parse executable files. I've got an "executable" base-class, and currently an "elf" class which inherits from it for parsing ELF files, and I will add more parsers (COM, MZ, PE, a.out, MACH-O, whatever) later on.

I want the program to automatically detect which kind of executable it's loading at runtime. It should be easy because every executable format I'm aware of/plan to support starts with a magic number. But because I can't have the parsers not check the file type (what if I re-use the code?), and I don't want to check each file twice (not just for performance, but also because only the ELF parser should know that ELF files start with "x7fELF", etc.) so I've come up with a pretty lazy solution: just try to parse the file with each known parser and have them throw an exception ("exe_type_error") if they can't parse it. If that exception gets thrown, try the next parser; if not, stop.

The remaining problem is how, at runtime, my program will know what parsers are available. I don't want to hard-code it in the main function; instead, I'd like the parsers to "register" themselves as available. That way, if I decide to go down the route of adding new parsers via dynamic linking, I will only have to add an API for dynamic libraries to register their parser, without recompiling any of the main program's code. I also want to do the same thing for another key part of the program (it's a static executable optimizer; it will run a series of "tests" (e.g. "is xor eax, eax faster than mov eax, 0 on this machine?") and optimizations ("if yes, change all mov eax, 0 to xor eax, eax") and I want to load those at runtime too).

View 11 Replies View Related

C++ :: Sending A String To Program?

Jul 21, 2013

I have a project, to make a program that spams chat programs. I've been trying to figure out how to send a string to an open program such as notepad, or a chat window. I know how to simulate keystrokes but I have yet to figure out or find out any way of sending a string to a program. pseudo code:

int main() {
string a;
int howManyTimes;
cin >> a;
cin >> howManyTimes;
//user enters "pizza"
for(int i = 0; i < howManyTimes; i++) {
//now I want "pizza" to be sent to the program keystroke enter or whatever the correct syntax is sleep
} }

View 1 Replies View Related

C :: Sending Variable From Server To Client Program (with Ack)

Feb 23, 2015

ok to start, windows based program, using pelles c ide

winsock2, using "sample" codes, able to connect, BUT no clue what 1/2 of the codes do, and most of the coding is for nix based systems!

trying to understand, and implement a minimal amount of code to add to a current menu based program!

being able to open connection, wait for input from server, receive input, acknowledge the input, then "act" then return to waiting for new input.

or vice versa, server waiting on client (but then server would have to send all the current status`s to client, so that client could be in real time, prob by sending an array from server to client).

View 11 Replies View Related

Visual C++ :: Error In Sending Mails Using SMTP In Program?

Apr 14, 2015

I am working on an application that should send mails to some recipient. I got a mail address tarek@abcd.fr use it to send a mail to tarek@gmail.com. each time I execute my program I got the following message when I send DATA "553, that domain isn't allowed to be relayed thru this mta (#5.7.1) ovh"

I tried to change my port from 25 to 587 (even 465) but I got the same result.

I am using Visual Studio 2010 on Windows 8.

View 2 Replies View Related

C :: Program To Hide Files Behind Other Files Using Alternate Data Streams

Apr 5, 2013

I am writing a program to hide files behind other files using Alternate Data Streams in Windows NTFS file systems.

The program is as follows:

Code:

#include <stdio.h>
#include <stdlib.h>
int main(void){
char hostfile[75], hiddenfile[75], hiddenFileName[15] ;
printf("Enter the name(with extension) and path of the file whose behind you want to hide another file: ");
scanf("%75s", hostfile);

[Code]...

The complier is showing error as "Extra Perimeter in call to system" but I am not getting where?

View 4 Replies View Related

C++ :: Eliminating False Sharing With TBB

Nov 9, 2013

So, as the title says, I'm trying to eliminate false sharing, or, eliminate sharing writes between threads with TBB. The question is how.

Normally I'd make an array whose size is equal to the number of threads, then locally write to a local variable and update the array only at the end of the thread.

But, of course, I cannot seem to get either thread id or total number of threads TBB uses. I found a reference to tbb::enumerable_thread_specific, which as I understand, is supposed to work for exactly this. But as soon as I added it, it hurt performance by ~60% instead of making it better.

How to do this properly? You don't really need to look so hard on how the algorithm works (I don't know either). I know it's not quite right right now due to race conditions, but I'll fix that later. I used a reference implementation that I copied™, and my task is to parallelize it.

The parts where the problem is right now is in red (of course, it's not all problems; it's only a subset of them).

Code:
#include <iostream>
#include <vector>
#include <fstream>
#include <ctime>
#include <algorithm>

[Code] ....

View 11 Replies View Related

Visual C++ :: 2 Programs - 1 Dll Sharing Variable?

Mar 16, 2014

my goal:

have 1 program handle the UI

have that program store variables to a DLL

have the 2nd program grab the stored variables to reform some number crunching, without interfering with the UI program, and once done, have it drop the answers back into that DLL, so that the UI can grab it when it's ready.

I have made the 2 programs, + dll

What I've Achieved:

the first program accesses the dll, and loads up a variable (and stays connected to the dll, so that the Dll instance doesn't reset)

I've gotten the DLL to output the variable to make sure it's received it, and stored it to it's own global variable.

the second program connects to the dll successfully, but when it tries to retrieve the data, it returns 0's (NULL's)

My research:from what I've read, so long the dll is connected to a program, all additional programs will attach to the same instance.

how do I make the global variable in the dll be accessible to both programs? (without resorting to saving it to the HDD Idealy)

View 7 Replies View Related

C# :: Sharing Item List Object Between Two Forms

Nov 4, 2014

I've changed up my code to the retail checkout WFA I am trying to make. I have an item list filled with objects of the now globally accessible 'Item' class, but I'm having trouble.

Essentially, I want to send an object of the item class chosen from a dropdown menu to form2, where I will fill in certain blank attributes with data entered in form2's text boxes and comboboxes. The problem, it seems, is I need another itemlist in form2 that will hold the object being passed to form 2, so I can then pass all the information to textboxes on form3 (the receipt/review page). It's been more than a year since I coded with C#, and I've forgotten quite a bit. I was also not able to find any tutorials on building an item list without an associated combobox or droplist, which is what I need.

This is my item class (minus most of its properties so the page doesn't stretch).

class Item {
public string prodName;
public string fName;
public string lName;
public string ccNum;
public string ccProv;
public string shipAddr;

[code] ....

For anyone who didn't see my last question, I'm in a User Interface Design class, not a C# class. I know this probably isn't the best code out there, but for my purposes the program just needs to compile beginning to end and pass the data like it should.

View 1 Replies View Related

C :: 3 Students Sharing Their Meals - Settle Bills Equally

Sep 28, 2013

There are 3 students (0=John, 1=Peter, 2=William) sharing their meals. Who does the cooking, does the shopping and pays for the bills. End of the month they sum it all up and settle the bills equally. Who must pay the most is outputted at the top, while the person that collects most is at the bottom. Students that have to pay the same amount are listed in the same order as they are ordered in the input. (receiving same amount, the same). Total of the settlement are rounded to whole cents. Sometimes they loose a cent, sometimes they gain one.

So I started making a plan what the program is supposed to do. Pen and paper:

1. Sum of the total amount from all the meals.
JohnPaid+PeterPaid+WilliamPaid=Total
Total / 3 = FairShare

calculate difference of all three the students

if JohnPaid == FairShare
print John receives 0.00

if JohnPaid > FairShare
print John receives difference

if JohnPaid < FairShare
print John pays difference

etc. (same for Peter and William)

Code:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>

/* type definition of student */
typedef struct student {
int who; /* 0=John, 1=Peter, 2=William */
float paid; /* amount that student paid */

[Code] .....

Example in/outputs:

<0 39.85>
<1 30.83>
<2 35.43>
Peter pays 4.54
William receives 0.06
John receives 4.48

<1 106.32>
<0 88.14>
<2 88.14>
John pays 6.06
William pays 6.06
Peter receivers 12.12

Looking at this code, I see a lot of global (general) variables. Do I need to adjust this skeleton code I received or should I just add code?

View 6 Replies View Related

C++ :: Using Resources In Executable?

Sep 8, 2014

i have seen a lot of programs that have images inside their exe, dont use external ones. I tried to add image in my codeblocks project, but trying to use it failed. It seems that to use a resource i have to add some kind of header file, but how to do this???

View 2 Replies View Related

C/C++ :: Executable Performance When Using TCHAR

Aug 16, 2014

I have started to move over to using Unicode, wide character null-terminated strings in my Windows programmes. Accordingly I set the Use Unicode Character Set Visual C++ compiler option. It is my understanding that once you do that the many macros which determine whether you transparently call ...A() or ...W() API functions automatically shift over to calling the wide character variants. As this is a compiler directive, all the choices are made and hardcoded in to the resultant executable at compile/link-time BEFORE it is ever run. Therefore using for example the macro OpenFileName() in the source code instead of specifically calling OpenFileNameW() has no impact on run-time performance.

The next logical step, instead of explicitly using wchar_t is to declare null-terminated string character arrays as TCHAR*. Then, so long as I also employ the tcn... variants of CRT string functions and call TEXT() or _T() macros to create string literals the preprocessor will chose, again transparently whether to create an executable using standard multibyte or unicode wide characters - and their associated functions - all determined by the Use Unicode Character Set switch. That way I can cover both eventualities with the same source code.

So, with all that - I THINK!!! - properly under by belt, I am fairly sure that using TCHAR and its friends will not effect run-time performance at all. However, in his otherwise excellent article the author makes it sound as if using Unicode EXPLICITLY through wchar_t, ...W() API functions and tcn... CRT calls is faster than the TCHAR alternative.

At the end of the day my question is - have I got the right end of the stick; TCHAR makes no difference to executable performance?

View 4 Replies View Related

C/C++ :: Debug Executable That Needs Flags

Mar 20, 2015

I'm trying to step through the machine instructions of a c program. This program needs to be run with a -t flag.

This is what I tried
gdbtui
file prog
layout asm
start
stepi

When I try 'file prog -t' it doesn't work.

View 4 Replies View Related

C++ :: GUI That Will Allow User To Conveniently Invoke Executable

Feb 12, 2013

I use g++ compiler and need some tips on how to get started with making a c++ GUI. The project I have will need a gui that will allow the user to conveniently invoke executable (the command-line args they take are long and inconvenient to enter manually) and basically print their output streams into a control (e.g. read only textbox). There will be a few graphics involved too (the input for those graphics will be from a file), so I'll need a library that will allow drawLine methods (nothing too fancy, I don't need a gaming library).

Making a GUI in c++. In Java the ability to make a GUI is a part of the native library, so the c++ way seems foreign to me.

View 2 Replies View Related

Visual C++ :: Prevent Executable From Running?

Aug 30, 2013

I would like to programmatically monitor a directory for new files, and if the file happens to be an executable, I want to prevent it from running. Something like a AV program.

However, I don't know where to start. Simple is best.

View 9 Replies View Related

C/C++ :: Eclipse Terminating Executable After Adding A Bit Of Code

Feb 3, 2014

I have the following code

#include "../header/FileIO.hpp"
#include <fstream>
#include <stdexcept>
#include <iostream>
std::string FileIO::ReadTXT(std::string filePath){
std::ifstream input(filePath.c_str());

[Code] ....

When I run it in Eclipse, it does not open an SDL window, and simply says <Terminated> Test.exe [C/C++ Application]. I can build the project successfully, but it simply won't run. There are no errors displayed.

HOWEVER, if I replace the above code with the code below, it runs fine, and creates an SDL window.

#include "../header/FileIO.hpp"
#include <fstream>
#include <stdexcept>
#include <iostream>
std::string FileIO::ReadTXT(std::string filePath) {
std::string output;
return output;
}

To make things weirder, if I run it in debug mode, even with the first piece of code, it will run and open an SDL window.

On an unrelated note, what does " Can't find a source file at "e:pgiawsrcpkgmingwrt-4.0.3-1-mingw32-srcld/../mingwrt-4.0.3-1-mingw32-src/src/libcrt/crt/main.c"

Locate the file or edit the source lookup path to include its location." mean? I am using Windows 8, MinGW, GDB 7.6.1-1, G++ 4.8.1-4, and MSYS 1.0.1 with Eclipse CDT.

View 3 Replies View Related

C++ :: How To Create Final Executable File That Can Upload For Users

Feb 16, 2013

I develop a software using QT 5 open source IDE. Now my question is two-fold:

1. How can I create the final executable file that I can upload for my users? I understand that runtime DLLs shall be required and I have tried Enigma Virtual Box software for bundling runtime files. It does create the file that I can execute from any folder in my PC. However, surprisingly when I transfer that "boxed" file to another PC, it does not run. Both the PCs have Windows 7 installed on them.

2. Secondly, I see possible future issues with Antivirus Softwares. Apparently when I try to run the boxed exe file, it gets rejected by the Antivirus Software on my PC. Is there a way in which I can get my exe file verified/checked/registered by the Antivirus Softwares so that my users don't face any problems in executing the program.

I cannot afford the QT commercial licence, but I am prepared to buy any economical "setup file generating" software (if it exists).

View 1 Replies View Related

C++ :: ReadFile Function Cannot Read Entire Executable File

Mar 30, 2014

I am writing a program which compresses files into .zip files.

Here's my problem: Whenever I want to compress an executable file, my readFile function does not read the entire file. When I extract the .exe I get a very tiny and incomplete file.

Here's the function I use to read files:

std::string miniz_wrapper::readFile(FILE* f, int MAX_FILEBUFFER)
//MAX_FILEBUFFER has a default value of 65536 {
char* tmp;
std::string tmp_s;
int count = 0;

[Code] .....

Prior to reading, every file is opened using fopen with the mode "rb".

View 6 Replies View Related

C++ :: Reducing The Size Of A Compiled Executable For Easier Distribution?

Jun 19, 2014

I am looking at reducing the size of a compiled executable for easier distribution.

What factors affect the size of an output executable?

Would literally having defined and implemented less functions, would make the exec. smaller? Meaning that instead of have a DLL ( yes im on windows ), I would download the source code of a library and comment out the functions ( and code ) that I am not using -- Would this process decrease the size of my exec.?

View 2 Replies View Related

C++ :: Turn Binary File Data Into Unsigned Character Array For Inclusion In Executable

Jul 10, 2013

So I wrote a program to turn a binary file's data into an unsigned character array for inclusion in an executable. It works just super.

I'm wondering how I can write a program that will perform this operation on every file in a directory and all it's sub-directories so that I can I can include everything I need all at ounce.

View 9 Replies View Related

C++ :: Generate Two TXT Files In One Program

Apr 4, 2013

I try to write my data into two different files and i just use something like this

ofstream myfile;
myfile.open("phase 1.txt");
if (myfile.is_open()) {
for(i=0;i<M; i++)

[Code] ....

But it only generate the first file. How should i modify this?

View 3 Replies View Related

C++ :: How To Use Two Header Files In Program

Sep 17, 2013

I want to use two header files in my program. Here is exactly what I want to do.

-In the first header I have a binary tree and a structure.
-In the second file I have another functions that need to use the structure in the first header.
-I also want to use a function from the second header in the first.
-And finally I want to do actions with both headers in a "main.cpp" file that contains only int main() function.

How to include the headers in each other and in the main.cpp to be able to do the actions above?

I try to include the first header in the second one and the second one in the first header. Then I include both headers in the main.cpp file. But the compiler shows me many errors.

View 5 Replies View Related

C# :: Sharing Variables From Login Form To Another Form

Mar 10, 2015

I have a form with 2 text boxes (Email and Password)

The user fills in the text boxes and clicks on the Log in button. The code behind the log in button does the following, First connects to a table (Users) in phpmyadmin. Next runs a SQL query (SELECT * FROM `users` WHERE Email = '" + sEmail + "' AND Password = '" + sPassword + "'") sEmail being the variable created from the text entered in Email text box and the same for password.

Next if the record count == to 1 it opens up the main menu form and if the record count == 0 it fails and the user does not get to the main menu.

All of the above is fine and working however what I want to do is take over a variable from the log in form to the other forms.

The code is below for the sign in button as all my code is behind that (I think this may be where I'm going wrong).

public partial class WelcomeForm : Form{
public static string connStr = "server = localhost; " +
"database = ppw5; " +
"uid = James; " +
"pwd = buster;";

[Code] .....

And the Main menu form where I'd like to take a variable over with me, lets assume the variable is the UserID from the database table that I pull from the dTable I created.

public partial class MenuForm : Form {
//Call the CloseProgram class and create a new method called ClassClose.
CloseProgram ClassClose = new CloseProgram();
WelcomeForm User = new WelcomeForm();
public MenuForm() {
InitializeComponent();

[Code] .....

View 7 Replies View Related

C :: Program Reading / Writing Files

Dec 10, 2013

program that I am working on. I want to use fgets() in my program so I could handle multiple words from a text(to be able to handle spaces). I get a weird result when running the program.

Code: #include <stdio.h>
#include <stdlib.h>
//#include "kim.h"
#include <string.h>
[code]....

View 4 Replies View Related







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