C/C++ :: Slow Down Program Output?
Apr 1, 2014
Is there a good way to slow down program output? usleep and nanosleep don't slow it down enough, delay doesn't work, and sleep keeps freezing my program. I am using Linux since I think this makes a difference in what I have to use.
View 9 Replies
ADVERTISEMENT
Aug 27, 2013
I am writing a program, the trouble is is that it uses a single thread and is SLOW.
View 10 Replies
View Related
Apr 17, 2014
I am trying to do this:
while(1)
{
CaptureScreenshot (as BMP)
Convert screenshot to 24 bit instead of 32 bit
Resize screenshot size
Get the BMP bits array of the resized screenshot
}
I have it working but the best i could get is 18 iteration (screenshots) per second. This is what i do:
Code:
Start() {
ULONG_PTR gdiplusToken=0;
HDC mhCompatibleDC;
HBITMAP mhCompatibleBitmap;
HWND mhDesktopWnd;
HDC mhDesktopDC;
byte*piRGB=new byte[1200*900*3]
[Code] .....
Here i do things with piRGB but these things are not counted it the timer so you can assume here the code ends . As said as the code looks now, i can fill piRGB ~18 times (18loops) in 1 second. I must improve that...
View 14 Replies
View Related
Dec 31, 2013
I dumped all symbols into C:WindowsSymbols folder, It takes more than 2 minutes to load an application which really surprises me. Why and when should I use those symbols?
View 1 Replies
View Related
Dec 8, 2013
how to get the output of this program.. I'm not completely lost but I need it in the simplest terms.
Code:
/*Recursive Trace
Written by Ron
April 2006
*/
[Code]....
View 9 Replies
View Related
Oct 8, 2014
How do you make a program output a ppm file?
Code:
#include <stdio.h>
void make_pixel
(
int r, // red intensity
[Code].....
View 7 Replies
View Related
Jul 22, 2014
Why is it that the program doesn't stop for me to see the output? Here is my code:
// accessing mapped values
#include <iostream>
#include <map>
#include <string>
using namespace std;
int main () {
char str[] = "This table is a good table, while this book is a good book.There is an umbrella on the table";
int n = strlen( str );
[Code] .....
View 1 Replies
View Related
Dec 10, 2014
I am trying to get my program to output the name from a file. The user should enter first name "or" last name. and if the user does not type the name from the input file. the get an error message. How do you do it
#include <iostream>
#include <fstream>
#include <string>
#include <cstdlib>
using namespace std;
const int NUM_STUDENTS = 17;
const int NUM_QUIZZES = 10;
const int NUM_EXAMS = 5;
[Code] ....
View 4 Replies
View Related
Mar 6, 2015
I am wrapping up a Linux/C programming assignment that requires several small programs for encrypting and decrypting text. There is a bash grading script which will be used to assess the performance of my programs. The script runs fine on my local machine and all of my tests pass, but when I run everything on my University's server via SSH, the script is not behaving the same. I am fairly certain the error exists somewhere in my C code, because no other students are having this issue. The 4 main programs consist of 2 daemons which wait for clients to connect via sockets, and the two clients. There is a daemon/client pair for handling encryption, and another for handling decryption.
And here is a screenshot of what happens with the same files on the remote server:As you can see, in the 4th and 5th tests (where the program's output should read), it's instead showing "ssIgnore this message". In later tests (not pictured) there is another message that reads "ddServer to client message". This text appears nowhere in my code or the grading script, so it must be server-side.
View 1 Replies
View Related
Feb 21, 2015
My project involves writing a c program to generate a set of 70 decimal numbers. I want to save the output (these 70 numbers) as a txt file. I tried the following:
1. prt scr of output screen and pasting it in notepad. NOT WORKING
2. going to DOS SHELL and doing the following:
c:TCBIN>output.exe>>output.txt
NOT WORKING. Text file is generated, but it does not contain output. It just says:
illegal command: output.exe
What do I do?
View 2 Replies
View Related
Apr 24, 2013
//code
ofstream outFile;
outFile.open("p4a.dat");
outFile << setw(8) << "90.0";
outFile << setw(8) << "75.0";
outFile << setw(8) << "36" << endl;
[Code] .....
View 1 Replies
View Related
Mar 27, 2013
basic code for writing output of a program to a file? I can't seem to find it online and I need it to complete a project.
View 2 Replies
View Related
Jan 23, 2014
Write a program that reads in ten whole numbers and that output the sum of all the numbers greater than zero, the sum of all the numbers less than zero (which will be a negative number or zero), and the sum of all the numbers, whether positive, negative, or zero. The user enters the ten numbers just once each and the user can enter them in any order.
Your program should not ask the user to enter the positive numbers and the negative numbers separately. Assume the user will type integer numbers.
this is what i got but it wont run saying there is an error
#include<iostream>;
using namespace std;
int main() {
int count=0;
int num;
int positive=0;
int negative=0;
[Code] ....
View 5 Replies
View Related
May 6, 2013
my program wont output any information to the text file that I have specified it just creates it but it leaves it blank
#include <iostream>
#include<string>
#include<iomanip>
#include <fstream>
using namespace std;
class Carloan
[code]....
View 2 Replies
View Related
Oct 14, 2013
So I have to write a program that outputs a check with correct spacing and everything.
Create a project titled Lab7_Check. Write a program that asks the user the check information and prints the check. The dialog should be as follows:
date: 2/23/2010
name: William Schmidt
amount, dollars: 23
cents: 30
payee: Office Max
your check:
William Schmidt 10/13/2013
pay to: Office Max $23.30
twenty three and 30/100 dollars
You may assume that a person always has the first name and last name (no middle names or initials). The payee name is also always two words. The dollar and cent amount are integers and the amount is always less than 100 dollars. Note that the dollar amount could be zero, in which case, when you spell the dollar amount, it should print "zero". The date is always a single (non-white space separated string). Your date, dollar amount in numbers and the word "dollars" have to vertically align.
This is the code I have so far.
#include <iostream>
#include <string>
using namespace std;
int main(){
string date;
string firstname;
string lastname;
[Code] .....
View 3 Replies
View Related
Dec 9, 2013
How do i display the output ? This program only saves the output to "gpa.txt" I want it to also display the output to cmd.
#include <iostream>
#include <iomanip>
#include <fstream>
#include <cmath>
#include <string>
using namespace std;
const int SIZE = 10;
[Code] ....
View 1 Replies
View Related
Mar 20, 2014
#include <iostream.h>
#include <conio.h>
#include <stdlib.h>
float CalcPriceMember1(int,float&,int&);
float CalcPriceMember2(int,float&,int&);
float CalcPriceNonMember1(int,float&,int&);
float CalcPriceNonMember2(int,float&,int&);
[code].....
View 8 Replies
View Related
Feb 29, 2012
im trying to write a program that prompts the user to enter three numbers and then prints them vertically (each on one line), first forward and then reversed. this is how the design should look:
enter three numbers: 1 43 54
your numbers fowards:
1
43
54
your numbers backwards:
54
43
1
this is what i have thus far when it comes to code....
#include <stdio>
int main (void) {
// local declarations
int a;
int b;
int c
[code].....
View 1 Replies
View Related
May 30, 2013
Write a well-commented C++ program that reformats and outputs the date. Prompt the user to input the date in the format dd/mm/yyyy and outputs it in this format month, dd, yyyy. For example, 07/06/2012 is displayed as June 07, 2012. You are provided with the file months.txt containing the months and their corresponding numbers, for example 01January 02February etc. Use getline(monthsFile,monthString) to read in a string from the file, and use the monthString.find() function to search for the number and extract the corresponding month.
-confused by the way she told me to use getline(monthsFile,monthString) => if I just do it like this I only get the first line from the txt file (01January)
-if I try putting all the months on one line in the txt file (which i'm not even sure i'm allowed to do), I'm not sure what to do for the length of my substring output. if I make it long enough to fit longer months like September, someone entering may gets both may and june in the output
-if I input all the months into separate variables, I'm not sure how to make it only output the month entered by the user
the months.txt file is as follows:
01January
02February
03March
04April
05May
06June
07July
08August
09September
10October
11Novmber
12December
View 1 Replies
View Related
Oct 4, 2013
I want to take the standard output of a shell command (in Red Hat, using tcsh, in my case) and redirect it into my program for processing.
(Then ideally I would love to take the output of my program and redirect it to yet another command, but this is a second issue.) Simple example: I naively thought this might work:
I want to type this on the shell:
Code: $ echo Harry > hello and I was expecting this output on my terminal:
Code: $ hello, Harry And this would be my simple hello program:
Code: #include <iostream>
#include <string>
int main() {
std::string usrInput;
std::cin >> usrInput;
std::cout << "hello, " << usrInput << std::endl;
return 0;
}
View 3 Replies
View Related
Jan 6, 2015
I am working on an assignment to enter a number and print all the prime factors of that number. I have that working, but the assignment demands the output be formatted in a strange way which I can't figure out. For example, in my current program entering 10 gets me 25, which is actually 2 and 5. But it should get me: ( 2 * 5 ) but I can't figure out how to do this. On the chance you need it, my code is below:
Code:
#include <iostream>
using namespace std;
int main( )
{
cout << "Number: ";
[Code].....
View 12 Replies
View Related
Oct 10, 2013
My program closes after the out even though i've used cin.get():
I want the program to stay open at least until you press enter, even after the whole output.
Code:
#include <iostream>#include <string>
int main()
{
std::cout << "Please enter your name";
std::string name;
std::cin>> name;
// build the message that we intend to write
[Code] .....
View 4 Replies
View Related
Feb 20, 2013
How to make it so an output for a program would print out the string in reverse/backwards? I was just curious on how to do this.
View 6 Replies
View Related
Oct 11, 2013
What does the order of console output from your program tell you about when the static object is initialized?
#include <iostream>
using namespace std;
//class
class Firstclass {
private:
Firstclass(); //constructor
~Firstclass(); //destructor
[Code] ....
Doesn't it allocate the class static variable to the heap, thus executing its algorithm then destroying it when the program ends - or. What exactly does it tell me? When the static variable is initialized, it takes place first before any of my other functions?
View 7 Replies
View Related
Jun 6, 2013
I wrote a program that should check if phrase is in file and output the result.
File:
//////////////
Eat my shorts!
Ay Carumba!
Stupid Flanders...
////////
Why my program doesn't cout?
#include <cstdlib>
#include <cstdio>
#include <iostream>
#include <fstream>
using namespace std;
string checkData (char Input[], char dataB [], int nMAX){
[Code] .....
View 2 Replies
View Related
Jul 21, 2013
I am trying to write a program that can communicate over a very latent internet connection involving a cellular modem. I have some software packages that handle all the telnet like business and will pipe stdout and stdin to a program I can have it execute.
The problem I am running into is that I have to send about 900 ASCII commands to an instrument to request data but it takes about a second between when a command goes out and when a reply comes back. This will wind up taking a very long time and I am looking to speed it up. All of the commands are independent of the reply so what I need to do is create a program that can send all 900 commands with maybe 10ms break between them and to not wait for a reply. It then needs to read the replies and write them straight to a file.
It seems like this should be achievable in C++ but I only have a very basic understanding of the language and thus am not sure where to start.
I am open to using other languages but thought C++ would be a reasonably good start so I can distribute the program to my coworkers. All of our work machines are Windows but if there is a simpler solution from Linux, I should be able to work something out. I'm just trying to avoid complication.
View 5 Replies
View Related