C++ :: Developing Application Without Exceptions
Feb 27, 2015
Is it possible to develop any application without exceptions? I don't want to try and catch exceptions and remove it.but I want to write codes which should never create exceptions is it possible?
View 3 Replies
ADVERTISEMENT
Jan 15, 2014
I have a HTML code and i need to developing a form application.
issue: i have a html code and a database table , how to put this together with code and link them and peu them on server ...
View 3 Replies
View Related
Feb 28, 2014
I am currently developing an application for backing-up cellphone contacts to a computer. The problem I am having is that I need my app to auto detect a cellphone (i.e. regardless of the Make and Model) when plug onto a computer and with a single click of a button "Backup" the app must backup all contact on the cellphone onto to the computer. How can I get my app to auto-detect a plugged cellphone and how can I go about reading the cellphone's contacts.
View 4 Replies
View Related
Dec 19, 2014
I want to create GUI applications in eclipse CDT(minGW compiler). Are there tools/plugins integrated with eclipse cdt which can let you develop GUI by drag&drop for the following libraries: wxWidgets, GTK+, QT or even WinAPI ?
View 2 Replies
View Related
Apr 29, 2015
I've got a project to develop a virtual pdf printer driver for windows in C++ programming language.
how to develop a virtual pdf printer driver. google only shows results for .NET languages but I need for C++ language only.
How to proceed to develop this driver.
View 2 Replies
View Related
Jul 8, 2014
How exactly would one go about throwing an exception from an object's constructor?
Take a look at this snippet:
#include <iostream>
#include <exception>
class ExceptionFoo : public std::exception {
virtual const char* what() const throw() {
[Code].....
View 8 Replies
View Related
May 24, 2013
I've been pondering which of these 2 approaches would make for the best interface for a library: Defining custom exceptions with specific names for different error scenarios but with standard behaviour, or simply using the predefined exceptions from the STL.
This is my current approach:
Code:
namespace rpp
{
class ConnectionError : public std::exception
{
public:
ConnectionError(const std::string &p_err);
[Code] .....
This seems to make for more descriptive code but it adds no functionality and the implementations are completely identical, which seems "off" to me, somehow.
View 8 Replies
View Related
Jan 9, 2015
The task is to use the assignment operator of a class, but change all the data except certain ones. For example, below we are to assign all Person data of 'other' except for 'name' and 'ID':
#include <iostream>
#include <string>
struct Person {
std::string name;
int ID, age, height, weight;
[Code] .....
Name = Bob
ID = 2047
Age = 38
Height = 183
Weight = 170
Name = Frank
ID = 5025
Age = 25
Height = 190
Weight = 205
Bob pretends to be Frank, but keeps his name and ID.
Name = Bob
ID = 2047
Age = 25
Height = 190
Weight = 205
But I think the way I did it is pretty lousy (note the wasted steps changing the name and ID only to revert them back? So the ideal solution should require no wasted steps, unlike the method above, and changes to what the exclusions should be should be in only one place (not two like above). Of course, we assume that Person shall have many, many data members (and constantly increasing), so that simply defining Person::operator= (const Person& other) to handle all data except for 'name' and 'ID' is out of the question.
View 3 Replies
View Related
Jan 4, 2015
In order to test catching exceptions from an initializer list, I deliberately did bad practice by hard coding an argument to a ctor that would cause a std::bad_allocto be thrown. Obviously better practice is to send a variable, but that would cause a compile error, so I hard coded a value.
The program I wrote creates Prime Numbers up to a specified limit which is an argument to the ctor of type std::size_t. The program works fine IMO, using g++ in cygwin:
$ time ./PrimesExe
Limit is 2000000
148933 Primes Created
real 0m1.210s
user 0m1.123s
sys 0m0.046s
Now when I send something invalid like a negative number or something too big for std::size_t, the program seems to run indefinitely, when compiled with g++ under cygwin. I haven't tested it yet on Linux.
However, if I do the same on VS2013 express, it takes about 15 seconds to print the expected caught exception message. I was not expecting it to take so ridiculously long compared to the reasonable amount of work involved in doing primes up to 2 million.
I have read up about what is involved in catching exceptions: stack unwinding, keeping track of what needs to be destroyed etc. But this is 1 object with 1 ctor argument, no Base classes or any other complications. So why such a long or indefinite amount of time?
This whole example is probably contrived, and I am wondering whether exceptions is the right tool for this - it is similar to the divide by zero problem, or could be considered a programming error to call a ctor with a bad argument?
Also, catching an exception thrown by an initalizer list seems a bit awkward in that one seems to have enclose the creation of the object and all subsequent uses of it (and any code in between ) in the same try block, otherwise it goes out scope. I suppose I could try to write a wrapper function that returns a smart pointer reference to a valid object, but I would have to test the validity of it's return too. That's the awkward part - there is probably a better way?
Are there any recommended ways of recovering from initializer list exception, that is, to allow the user to enter a new hopefully valid value and try to create the object again?
View 2 Replies
View Related
Nov 2, 2014
Here is an example,
Code:
int main()
{
try{
int y = 0;
int x = 2/y;
}
catch(...)
{
cout<<"catch it"<<endl;
}
return 0;
}
If you try, you will find out that catch(...) couldn't catch exception divided by zero. How'd we catch such exceptions?
View 4 Replies
View Related
Mar 24, 2014
I am actually working on IEEE Arithmetic especially the IEEE 754 specification where the IEEE double only have 53 bits of precision. I am working on Z/nZ matrix multiplication that works on 53 bits specs. How to write a matrix multiplication algorithm that works well on 53 bits IEEE precision standard.
View 5 Replies
View Related
Feb 25, 2015
I'm Getting exceptions on Windows 7 and Windows 8 on different parts of the Code? Why this can be happening, why the difference in behavior?
View 6 Replies
View Related
Nov 29, 2014
What happens if I make a server application using tcp protocol and then establish connection with a client application but the server crash and then the client send data. Will the data be lost or the system will continue trying to send it?
View 2 Replies
View Related
May 9, 2012
I want to create an application that starts an application and passes input to that application. I know how to start a process using the classes in System.Diagnostics, but I don't know how to pass data to the process.
For example, and this is just an example, I would like to be able to automatically start an application that requires a username and password and automatically enter the username and password. Of course, that might open the door to security vulnerabilities, but that's not the point of the exercise.
How to implement the functionality I described? Is there a general way to go about doing this or does it depend entirely on the idiosyncrasies of the application in question?
View 2 Replies
View Related
Oct 4, 2012
i have task scheduling application which execute every 30 minute i want to keep this process when system is log off in c# console application
View 2 Replies
View Related
Jan 6, 2014
Is there any way to input a picture into an application? I want to make the console of my C++ program display an image across it for a short while. The picture in mind is a gif. If there is no way to make it display in the console, is there a way to make only the image and not the webpage pop up on the screen?
I am trying to replicate the Skyfall "M gets hacked" scene. But this would be useful for other purposes as well.
I am not familiar with using header files or any other files other than the .cpp file and I only use one .cpp file for all my programs.
View 7 Replies
View Related
Aug 26, 2012
I am using an increasing number of applications which can be serviced from a web page. These apps do not need tomcat, apache or IIS to be installed but they are able to serve out web pages on demand.
Question is how is this done? Is it just a thead polling a port, waiting for a mime message and then chucking out the content or is it something more complex than that?
View 3 Replies
View Related
Jun 8, 2014
I am having trouble converting strings in my application.
This is the code that is eventually getting called, the first parameter takes a LPCWSTR
Code:
hr = m_pGraph->RenderFile(m_filePath, NULL); // takes LPCWSTR This is where the trouble begins.
The compiler shows that sResult is proper but after I try to convert a std::string to a wchar it prints garbage
Code: const wchar_t* m_filePath = (wchar_t *) oDb->GetNext().c_str();
Code:
std::string CSqlLiteDatabase::GetNext() {
sqlite3_stmt *oStmt = nullptr;
std::string sql = "SELECT path || filename FROM table WHERE id = 1";
char message[255];
[Code] ....
View 6 Replies
View Related
Apr 1, 2014
i developed 2programm that the first one is in C and the second one is in c#.and now i have to send some string text from c to c#.how can i do that in c ?
View 8 Replies
View Related
Feb 19, 2014
I am looking at a same application in c that uses two different timing techniques. One involves the nanosleep() function which suspends thread for given nanoseconds. The other one uses a combination of gettimeofday() which returns number of microseconds since epoch as a start value. Then it uses var counter of for loop as max value. And it uses ellapsed time for each call of gettimeofday in microseconds in a do while loop to increment diff, until diff is not less than var. Why would someone choose to use this timing techinque be used instead of nanosleep?
Code:
unsigned long getTime() {
struct timeval detail_time;
gettimeofday(&detail_time,NULL);
return (detail_time.tv_usec);
[Code] .....
View 1 Replies
View Related
Aug 22, 2014
I was wondering if there was a possible way to change my c program into an application so that i can send the application to another person and not let the other person have access to my codings?
My reasons for asking this question: For the application i want to send there are secrets that are meant to be unraveled by gameplay but i dont want people to look at the codes and know everything.
View 6 Replies
View Related
Apr 6, 2013
Any tutorials on adding a UI to a console application? All I really need is a button that will run one function every time I click it.
View 1 Replies
View Related
Sep 12, 2014
I'd like to make a logger for my GUI application. I currently use std::cout and std::cerr, but I'd like to replace these with an arbitrary buffer which isn't connected to stdout or stderr. My requirements are:
1. On the user-side, the usage should be identical to any ostream object (including support for std::endl).
2. When std::flush is received, it "signals" my logger so I can run this line of code:
LogWindow->setText( mybuf.str() )
I think I need to extend a std::basic_stringbuf<char>, but which virtual method do I need to implement in order to print to my custom window?
My first attempt is this. I'm testing with std::cout, but the output is empty and running in the debugger doesn't trigger a breakpoint in my sync() method.
#include <ostream>
#include <iostream>
class MyBuffer : public std::streambuf
[Code].....
View 6 Replies
View Related
Sep 7, 2013
I have this problem, then solve it by using the other kind of SDL.dll(eg. 32-bit instead of 64-bit). However, I get the error
The application was unable to start correctly (0xc00000be). Click OK to close the application.
no matter what SDL.dll I use. So far, the only solution does not work for me,
View 4 Replies
View Related
Mar 16, 2013
I have developed an application in C++ that creates some text files in a directory chosen by the user.
How can I ask the user set a Default Directory Path (and some other default parameters) so that she doesn't have to enter the same data in the GUI everytime the application is run.
The application has been developed using Qt Creator.
View 3 Replies
View Related
Dec 18, 2014
I have a service A, and an application B. Service A needs to launch application B only if it's not running currently. This can be easily done in Windows by calling GetExitCodeProcess function. I cannot find an equivalent method for doing so in Linux/Mac.
So my current code says:
system("open /Users/adsmaster/client/client &"); // to launch the application from the service in a new shell
I read that on a Linux-line machine you can use $ cal to get the exit value of the recently run process but I am not sure how can get the exit value of a particular process?
View 1 Replies
View Related