C :: Program In Which Computer Will Read Txt File And Encrypt It

Jan 1, 2014

I am writing a program in which the computer will read a txt file and encypt it. The encryption works fine, but the computer cannot read the file perfectly. If there's a newline, the scanning process stops. For example I have the following text in the txt file.

One two three four five
(newline) Six seven eight

The computer will stop reading after 'five'. I assume that is because I use fgets.

View 4 Replies


ADVERTISEMENT

C :: Program Attempts To Encrypt A File Using XOR Operator?

Mar 18, 2013

My program attempts to encrypt a file using XOR operator. However, when I attempt to encrypt a file, it says "Error in reading file", (a printf function I set up if the program could not read the file, obviously). The problem is that I don't know what's causing this. Instead of encrypting the file, it just deletes all the characters in it, so I put in a fprintf to put place some text into the file. Here is the code:

Code:

#include<stdio.h>
#include<string.h>
int encryptd(FILE *);
int main(void)
{
FILE *fileptr;
int recode;
char fname[25];

[Code]...

View 7 Replies View Related

C :: Encrypt Message Within BMP File - Incorrect Struct Size

Feb 9, 2015

I'd wrote a program to encrypt a message within a bmp file using my own structs and all for everything (yes, call me a ........head) The program works but for some weird ........ing reason I was forced to subtract 2 bytes from the header size to get the correct value. I've narrowed down the issue to my BmpFileHeader struct.

Here's a short program that demonstrates the issue:

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

#define BYTE unsigned char
#define WORD unsigned short
#define DWORD unsigned long
#define LONG signed int

[Code] .....

Tried with both gcc and TinyCC and got the same result so it doesent seem to be a compiler bug. Microsoft's structures though are giving the correct size, even though they have the exact same definition.

Microsoft's defines:

Code:
// windef.h
typedef unsigned long DWORD;
typedef unsigned char BYTE;
typedef unsigned short WORD;

[Code] .....

View 5 Replies View Related

C# :: Program That Scans Computer Screen?

Nov 20, 2014

I have a problem with a program..I wanna make a program for scan the computer screen.I mean for example there is a video which shows just 5 pictures(apple,pear,banana,strawberry,cherry pictures) but this pictures are turning nonstop in one second. and this case is continuous progress.There are 5 pictures and are chancing. Lets get my problem, I wanna make a program and when apple on the screen my keyboard will push 1,when pear on the screen my keyboard will push 2,banana is 3,strawberry is 4,cherry is 5. I have this 5 pictures which are in the video and I will introduce tham to program and I wanna compare my lib. and screen and get output.

View 3 Replies View Related

C++ :: Computer Restarts Every Time Program Is Compiled

Feb 26, 2013

I have a weird problem, my computer restarts imidiately after program writen in dev-cpp is compiled AND run. When I run any program, it lasts about 1 second, then program closes, and computer reboots. It doesn't matter whether program is writen now or earlier, my dev-cpp version is 4.9.9.2. Source code can be as simple as this:

#include <iostream>
#include <conio.h>
using namespace std;
int main() {
getch();
return 0;
}

and it restarts anyway...

View 2 Replies View Related

C :: Program Where A Computer And Player Take Turns Rolling Dice

Feb 19, 2013

I am making a program where a computer and player take turns rolling dice.

There seems to be an issue somewhere in my loop where when the player selects from the possible dice choices, it rolls for the computer and does not select the choice and it immediately becomes the player's turn again.

I am trying to get it to where when the computer rolls the dice, it should display the list of possible values, and ask the user to hit the enter key in order for the computer to choose which value to select using the following command:

Code:
while ( getchar() != '
' ) ; I've tried it a hundred times and no matter where I put the command it still skips the computer's turn.

Below is my code:

Code:
while (compscore < 99 && playerscore < 99){
printf("You have rolled the following pair of dice:
");
a =("%i ", rand() % (MAX_VAL - MIN_VAL + 1) + MIN_VAL);
b =("%i ", rand() % (MAX_VAL - MIN_VAL + 1) + MIN_VAL);
multiply = a * b;

[Code] ....

View 11 Replies View Related

C++ :: Transfer TXT File From Computer A To B?

Aug 4, 2014

how could I transfer a .txt file from Computer A to Computer B using c++. (over LAN)

View 3 Replies View Related

C++ :: Program To Check If User Presses Power Button On Computer

Jun 19, 2014

How you can make a c++ program that checks to see if the user presses the power button on their computer? And if so, how?

View 1 Replies View Related

C++ :: Program To Model Operation Of Incoming Flights Computer Screen

Apr 14, 2013

The project is "Design and write a program to model the operation of incoming flights computer screen that is normally found at a typical small airport like Moshoeshoe I airport (if they do have one). The following provides the information that needs to be displayed about each flight:

• Airline - [string of maximum length 15] Name of the airline, eg. FlySAA
• Flight Number - [string of maximum length 5] eg. 04120
• Origin - [string of maximum length 25] Place where the flight originated from eg. Johannesburg
• Date/Time - [integers: Hour, Minute, Day, Month, Year] Arrival time of the flight
• Status - [string of maximum length 15] Whether the flight is "OnTime" or "Delayed"

View 4 Replies View Related

C++ :: Function To Search For A File In Computer

Apr 4, 2013

#include <iostream>
#include <cwchar>
#include <string>
#include <Windows.h>
using namespace std;
#include <shellapi.h>
#pragma comment(lib,"shell32.lib")
static HWND hBut;
#define ShellExecute;

[Code] ....

My function is the issue. I'm not sure how to write a correct function to search your computer for file 'a'.

View 3 Replies View Related

C++ :: Guessing Game Program - Ask User To Guess Computer Generator Number

Feb 11, 2013

I'm currently creating a guessing game program where the user will be asked to guess the computer generated number. Once the program is finished, at the end the user will be asked if they want to play again. If the user types "Y or Y" the program will loop and when the user types "n or N" it will not loop. Check out my code below.

#include<iostream.h>
#include<stdio.h>
#include<dos.h>
#include<stdlib.h>
#include<conio.h>
#define g gotoxy
void main(){
int a,l,b,guess,row,col,answer,num,clue=5;

[Code] ....

I can't loop this program.

View 3 Replies View Related

C++ :: File Handling - Program To Read Inputs In TXT File

Mar 26, 2013

I've written a program to read inputs in a text file. The file named Input.txt contain integers 2 3 and 4. My program is as follows:

#include<iostream>
#include<cstdlib>
#include<fstream>
using namespace std;
int main (){
int x,y,z;

[Code] ....

the program is outputing x=2293616 , y=0 and z=0 instead of x=2, y=3 and z=4.

View 9 Replies View Related

C/C++ :: Putting Computer Info Into CSV File - Batch Files

Dec 8, 2014

I am trying to use a combination of windows batch scripts as well a C++ program to put users data into one single .CSV file. Right now, I have a batch file that will output data from the command line into multiple .txt files. These files are mac.txt, serialnumber.txt, computermodel.txt, and computer name.txt. What I want to do, is to have users run the batch file, which will in turn run the .exe C++ file which will concatenate all their data into one file, computerinfo.csv. The file format for this file would be to have the mac address, serialnumber, computer model, and computer name all in their own column.

My main issue is that these individual files don't have the format that I would like, but based on the command prompt functions, there isn't really any good format. For example, the mac.txt file has the following format:

Physical Address Transport Name
=================== ==========================================================
xx-xx-xx-xx-xx-xx DeviceTcpip_{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}
yy-yy-yy-yy-yy-yy Media disconnected
zz-zz-zz-zz-zz-zz Media disconnected

but all I really want is xx-xx-xx-xx-xx-xx

The other files have other issues with format, but if I can figure out this one then the others should be a piece of cake.

Also, I want the output of this to all go in one row, and as other users run this file, they will go into new rows without touching the rows above.

View 1 Replies View Related

Visual C++ :: Find And Open A File On Remote Computer

Feb 26, 2013

I have a file on one server(Windows 2003) and need to access from another server (IIS server - Windows 2008) , I have written the program for the same which works fine and I can access the file.

But when this comes to the DLL (which registered successfully on Windows 2008), its not able to find the file on Windows 2003.

View 15 Replies View Related

C :: Program Not Read The First Line Of File

Dec 2, 2013

I have been working on a program to scanfile and whenever it encounters what the user wanted it prints it, and it is all right less the first line of the file that the program jumps,

Code:

#include<stdio.h>#include<string.h>
#include<stdlib.h>
void main()
{
unsigned int j=0 ;
char num[100] , str1[100], str2[100];
FILE *fp;

[Code]....

View 3 Replies View Related

C++ :: Program To Read Several Strings From A File

Oct 11, 2013

Write a program that reads several strings from a file. Display the number of words then display each word as shown in the sample below. Assume that the maximum number of string in the file is 100.

Sample Input (.in):
Smitty
Werbenjagermanjensen.
He
was
number
1!

Sample Output:

Total Number of Words: 6

Word[0] = Smitty
Word[1] = Werbenjagermanjensen.
Word[2] = He
Word[3] = was
Word[4] = number
Word[5] = 1!

View 1 Replies View Related

C/C++ :: Program To Read Values From A File?

Sep 18, 2014

I am trying to get my program to calculate what point goes in what quadrant using a file. But msy program is not reading the values from the file and also it is not running so im not sure what's wrong with it.

//This program uses a fstream object to write data that will read the values of a (x,y) point from a file.
//add the appropriate preprocessor
#include <fstream>
#include <iostream>

[Code].....

View 6 Replies View Related

C++ :: Spell Checker - Check If Inputted Word Is In Dictionary File On Computer

Jul 31, 2013

Over the last few days, I've been trying to implement a spell checker in c++ that checks if the inputted word is in the dictionary file on my computer. However, as I'm nearing completion of the project, I keep running into more and more errors, some of which I do not understand. My program is complete, albeit, with some minor bad practices (I hard coded a few things just to get the program up and running.For some reason, everything works well until I output spelling suggestions. I type in "mses" (attempting to spell mess) and it returns some strange characters. It does definitely recognize that there are two permutations that match words in the dictionary (however they are both mess due to the algorithm implemented), and I don't understand why? I will work on removing the duplicates after.

// Spell Checker.cpp : Defines the entry point for the console application.//

#include "stdafx.h"
#include <stdio.h>
#include <string>
#include <stdlib.h>
#include <fstream>
#include <iostream>

[Code] .....

View 7 Replies View Related

C++ :: Program Doesn't Read The End Of File Sequence

Aug 16, 2014

i have a question, i'm studyng the string library type and i have to write this program :

Code:

std::string word;
while (std::cin >> word) {
std::cout << word << std::endl;
}
why if my input is :

hi my name is ^Z

the output is :

hi
my
name
is

why the program doesn't fall out from the while loop ?

why my program does not recognize my sequence of end of file ?

View 5 Replies View Related

C++ :: Program That Allow User To Read / Write Onto File

Jan 28, 2013

So I'm trying to create a program that allows one to read/write on to output.txt. I though I had everything set up right, but its only writing one word to the text file. Heres the code.

#include "stdafx.h"
#include <iostream> //Needed for User Input
#include <fstream> //needed for ofstream
#include <string> // needed for strings
#include <windows.h> //needed for Sleep
#include <cstdlib> //Needed for return EXIT_SUCCESS;

using namespace std;
int main() {
ofstream outputfile; //allows to read and write to files

[Code] .....

If I type Puppies Are Cute and go to output.txt, the only thing written in the text file is Puppies.

View 9 Replies View Related

Visual C++ :: Get Program To Read From File Of 15 Scores?

Dec 10, 2014

I'm trying to get the program to read from a file of 15 scores. 10 are quizzes 5 are exams. I want my program to read from the input file the first name "or" last name and if the user puts a different name, the program Gives off an error screen message

Code:
#include <iostream>
#include <fstream>
#include <string>
#include <cstdlib>
using namespace std;
const int NUM_STUDENTS = 20;
const int NUM_QUIZZES = 10;
const int NUM_EXAMS = 5;

[code]....

View 14 Replies View Related

C :: Program To Read In A Tab Deliminated Text File Of Xyz Coordinates

Nov 14, 2013

I have been working on a program to read in a tab deliminated text file of xyz coordinates of atoms/particles and store the values in three seperate arrays. This is my code so far:

Code:

#include<stdio.h>
#include<stdlib.h>
void fileinput(FILE *ifp) {
int N, column, atom;
int c;
column = 1;

[Code]...

Supposedly this should assign the values in the text file to the cooresponding arrays but when I run the code on a simple test file all I get is:

Code:

$ ./input.o -i ./test.txt
Atom one coodinates x 0.000000, y 0.000000, and z 0.000000 Where test.txt is: Code: 1.0000 2.000 1.5
3.0000 5.000 1.4
4.0000 3.000 1.3

View 1 Replies View Related

C++ :: Write A Program That Will Read Names From Input File

Apr 24, 2014

I have a lab with the following instructions:

Manually create an input text file called Lab22BInput.txt with the following data:

Dove
Doe
Alston
Zebra
Egg

Write a program that will read the names from the input file. Print out each of the names read to the screen. The program should go through the list of names and determine which comes 1st in the alphabet. The program should determine how many letters are in this name. Print out the name that comes first in the alphabet and the length of the name.

I have created the input file, and the data correctly outputs to the screen when I run the program. However, I do not know what kind of logic to use to sort them alphabetically and determine the amounts of characters.

So far I have the following:

#include <iostream>
#include <string>
#include <fstream>
using namespace std;
int main()
{
string str1, str2, str3, str4, str5;

[Code]...

View 2 Replies View Related

C++ :: Program To Read In Reverse Order Contents Of A File

Jan 5, 2015

Need to correct the errors. i've done so far.

#include<iostream>
#include<fstream>
#include<cstdlib>
#include<iomanip>
using namespace std;
int main() {
ifstream fin; char ch; int size=0;

[Code]...

View 5 Replies View Related

C/C++ :: Program That Uses While Loop To Read A Set Of Integers From Input File?

Apr 20, 2014

The question is "Write a program that uses a while loop to read a set of integers from an input file called "data.txt" and prints the total number of even numbers read from the file."

Code below is the program I have created so far. I keep getting the window to pop up but not stay up so I am assuming I am doing something wrong.

#include <iostream>
#include <fstream>
using namespace std;
int main() {
std::fstream input("data.txt");
if (!input.is_open()) {
std::cout << "There was an error opening data.txt";

[Code]...

View 5 Replies View Related

C :: Program To Read Binary Data And Print It - File I/O Error

Mar 14, 2013

Objective of this program is to read binary data from a file and print it.

Code:
#include <stdio.h>
void readFile(void);
int main(){
readFile();
return 0;

[Code] .....

But When I Run This Code First It Print "Error." Then Rest Of The File.Say In My File I Have "I AM HUMAN", It Prints "Error. HUMAN"!!

I Cant Figure Out Whats Wrong In The readFile() Function.It seems right to me.

View 4 Replies View Related







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