C++ :: Zlib Outputting Blank File?

Oct 30, 2014

I wrote a program to compress a file with gzip, which works fine. I also wrote a program to decompress the gzip file, which runs but outputs a blank file.

Code:

main.cpp:
#include "decompress.h"
int main(int argc, const char * argv[]) {
if(argc == 3) {
decompressor(argv[1], argv[2]);

[code].....

View 4 Replies


ADVERTISEMENT

C/C++ :: Can't Find Or Compile Zlib With Minizip

May 18, 2012

i've been trying to download and use minizip, but i just can't compile it and i can't find any way to download it correctly.

i downloaded a file called zlibwapi.lib from the offical site of minizip and i downloaded the header files, but it just wont work. it keeps writing me these linker errors(MS Visual Studio 2008):

error LNK2019: unresolved external symbol _unzOpen referenced in function _wmain
fatal error LNK1120: 1 unresolved externals  

View 1 Replies View Related

C++ :: Getting Data From A File And Outputting

Apr 17, 2013

I am given a data file that contains sports data for 24 people. There are two rounds of the event. The first 48 lines of the file give the data for the 1st round and the second 48 lines give data for the 2nd round. The file looks like this:

Azrin, Neil
2.3 6.0 5.0 6.7 7.8 5.6 8.9 7.6
Babbage, Charles
2.3 5.6 6.5 7.6 8.7 7.8 5.4 4.5
Burks, Arthur
2.8 4.5 5.4 6.6 7.7 8.8 5.6 6.5
Crick, Francis
1.6 6.5 6.5 6.5 7.3 7.5 7.8 5.6
and so on ............

This data continues for all 24 people and then repeats with different score values for the second round. The first number after the persons name is the level of difficulty and then next 7 numbers are the scores. I am trying to get this data out of the file and set it up in the following format:

Name Of Person
Round 1: level of difficulty scores
Round 2: level of difficulty scores

So the table for the above data would look something like this:
Arzin, Neil
Round 1: 2.3 6.0 5.0 6.7 7.8 5.6 8.9 7.6
Round 2: 2.1 6.0 5.0 6.5 7.8 5.6 8.8 7.6
Babbage, Charles
Round 1: 2.3 5.6 6.5 7.6 8.7 7.8 5.4 4.5
Round 2: 2.3 5.4 6.5 7.6 8.7 7.2 5.4 5.5

And so on for all 24 people. This is the code I have for it, but it just reads the file directly:

// I have already opened the file!
while (inFile) {
string name;
getline(inFile,name);
cout << name << endl;
}

How I can do some sort of formatting on this data?

View 1 Replies View Related

C/C++ :: Getting Error When Outputting To File

Sep 5, 2014

it isn't actually writing anything to the file. It is opening the employeesOut.txt file but not writing anything. I'm getting the error

libc++abi.dylib: terminating with uncaught exception of type std::invalid_argument: stoi: no conversion
(lldb)

I believe the error is within my main.cpp, so here that is, I have multiple classes.

#include <iostream>
#include <string>
#include <fstream>
#include "Employee.h"
using namespace std;
bool openFileForReading(ifstream& fin, const string& filename);

[code]....

View 12 Replies View Related

C++ :: File Save Routine - Blank Records In Module

Jul 10, 2013

I have faced a strange problem in File Save Routine. I have written a module to save data to binary file . I have designed a structure and put information in that and save it to file . I save multiple such records one after other. I use fwrite , fflush instructions.

The module is working fine. I have saved near about 35 such files. But in one file , the module has saved Blank Records. The file size if perfect but the file is totally blank. It has happened for only one file but need to know the reason.

View 14 Replies View Related

C++ :: Outputting Transactions From A Text File To Screen

Jan 19, 2014

I am working on a wage application with four options which are as follows:

Subtracts an amount from the shop bank account (The account is text file "shop"). You do not need to add the same amount to another account but you should record the transaction with a timestamp in a separate file. The application should prevent the account balance from becoming overdrawn.

List the five most recent transactions to the screen. If there haven’t yet been five transactions then list all of them.

Print the account name, number and current balance to the screen.

Exit the program.

I have completed 1,3 and 4 but I am completely stumped as to how to go about number 2.

#include <limits>
#include "stdafx.h"
#include <iostream>
#include <fstream>
#include <ctime>
#include <string>
int read_balance(void);
void write_balance(int balance);

[Code] .....

View 1 Replies View Related

C++ :: Outputting Partially Filled Array Onto Text File?

Jul 24, 2014

I have a partially filled array and I want to put that into a text file. Say I don't know how partially filled it is. How would I stop at the very end of the array where it has the last amount of data.

ex.
int array[9] = {1,2,5,6};
ofstream output("txt file");
for(int i = 0;i < 9; i++){
output << array[i]
}

How would I stop as soon as i becomes 4 because that is when the array stops?

View 1 Replies View Related

Visual C++ :: Internet Explorer Displays Blank Page When Opening Local File While Screen Is Off?

Apr 28, 2015

I'm making a small MFC module that should generate a report (formatted using HTML) and then display it for a user on schedule at 8:30 AM every day. Pretty straightforward stuff.

I compose my report and then save it as a local HTML file in the CSIDL_APPDATA folder. I then use the following calls to display it using the default web browser (Internet Explorer in this case):

Code:
//Error checks are omitted for brevity
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
ShellExecute(NULL, NULL, strSaveFileTo, NULL, NULL, SW_SHOWNORMAL);

This module is run on schedule from the Task Scheduler. (The task is set up to run when a user is logged on, which is all the time for that PC. It is never turned off, put to sleep, etc. That computer has only one user that is never logged off either.)

This works perfectly fine when I test it by setting the task a minute or so in the future. But when the actual task is supposed to run at 8:30 AM, when the user wakes the screen all they see is a blank Internet Explorer page. (Note that if someone refreshes that page by hitting F5, only then my report is shown on the screen.)

So I started looking into it:

1) I checked that the file is properly saved (before calling ShellExecute) by reading it back and by comparing it with the original HTML markup that I saved earlier. It's all correct there.

2) I then checked the power saving options. That computer is set up to show screensaver after 5 minutes and to turn off screen after 25 minutes.

3) The web browser that causes this issue is IE version 11, with the latest updates installed. The operating system is Windows 7 Professional.

And why is IE showing a blank page only when computer is running unattended?

View 14 Replies View Related

C++ :: Outputting Data From File Into Structs And Arrays Of Structs

Apr 15, 2013

I am having a lot of trouble being able to get data from a file and input it into given structs and arrays of structs and then outputting the file. We are given a file that contains 96 lines and looks like this:

Arzin, Neil
2.3 6.0 5.0 6.7 7.8 5.6 8.9 7.6
Babbage, Charles
2.3 5.6 6.5 7.6 8.7 7.8 5.4 4.5

This file continues for 24 different people and then repeats with different scores (the second line).
The first number, in this case is 2.3 for both people is a difficulty rating. The next 6 numbers are scores.

We are given this data in order to set up our structs and arrays and my code:

#include <iostream>
#include <fstream>
#include <iomanip>
#include <string>
#include <cmath>
using namespace std;
int main () {
ifstream inFile;
inFile.open("C://diveData.txt);

[Code] .....

View 1 Replies View Related

C++ :: Draw 2D Grid With Blank Cells?

Mar 21, 2014

I am trying to draw a 2d grid array for a battleships game. I need the grid to have a border around each cell, how to do this. so far my code is:

#include<iostream>
using namespace std;
int main(){
int grid[5][5] = {{0}};

[Code] .....

View 4 Replies View Related

C++ :: String Outputting Twice?

Nov 3, 2014

When I run the program, the prompt I am giving the user before I collect their data, shows up twice in row. Here's the part of the code I'm referring to:

#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
// method prototypes
void characterInstructions();
void phraseInstructions(); //

[Code] ....

View 6 Replies View Related

C++ :: Keep Looping Until User Enters A Blank Line?

Aug 4, 2013

My goal is to create a loop that keeps taking user input over and over until the user doesn't enter anything into 'cin >>', leaves the line blank, and simply presses the ENTER key to move on, at which point the program is supposed to break out of the loop and continue on with the rest of program execution. Something like this:

Code:
do {
cout << "
Enter a name: ";
cin >> input1;
if (input1.empty())

[Code] ....

As you can see, I've already tried using the empty() function, but that didn't work, the program simply stays in the loop and doesn't break out, no matter how many times I press enter. It just keeps prompting me to enter a name. I've also tried using something like

Code: if (input1 == "")

but that doesnt work either. How do I break out of this loop?

View 2 Replies View Related

C++ :: Code Compiles Successfully Yet Previous Day Is Blank

Feb 17, 2013

//#include "stdafx.h"
#include<iostream>
#include<cmath>

using namespace std;
//class declaration
class dayType{
public: int presday;

[Code] ....

So everything works perfectly, well not everything lol. Code compiles successfully without any errors but previous day does not calculate. In a sense that when it asks for number of previous days it returns a blank statement.

For example: Previous number day is: shows nothing

View 2 Replies View Related

C++ ::  No Compile Errors But Blank Screen On Execute?

Oct 23, 2013

I'm working on a Hash Table implementation and after fixing all the errors and finally getting it to compile and link correctly, I am met with a black screen upon execute.

main.cpp
#include <stdio.h>
#include <string.h>

[Code]....

I tried inserting a debug statement in the main() function to see, and it wouldn't even print out the message "debug me" on the screen.

I am using Code::Blocks on Windows with the mingw32-g++.exe compiler. Here is my build log:

mingw32-g++.exe -Wall -g -c D:MediaDesktopHashElement.cpp -o objDebugElement.o
mingw32-g++.exe -Wall -g -c D:MediaDesktopHashHashTab.cpp -o objDebugHashTab.o
mingw32-g++.exe -Wall -g -c D:MediaDesktopHashmain.cpp -o objDebugmain.o
mingw32-g++.exe -Wall -g -c D:MediaDesktopHashStudent.cpp -o objDebugStudent.o
mingw32-g++.exe -o binDebugHash.exe objDebugElement.o
objDebugHashTab.o objDebugmain.o objDebugStudent.o -mwindows
Output size is 1.06 MB
Process terminated with status 0 (0 minutes, 2 seconds)
0 errors, 0 warnings (0 minutes, 2 seconds)

View 11 Replies View Related

C++ :: Keep Looping Until User Enters A Blank Line?

Aug 4, 2013

So I've run into the following problem. My goal is to create a loop that keeps taking user input over and over until the user doesn't enter anything into 'cin >>', leaves the line blank, and simply presses the ENTER key to move on, at which point the program is supposed to break out of the loop and continue on with the rest of program execution. Something like this:

do {
cout << "
Enter a name: ";
cin >> input1;
if (input1.empty()) {

[Code] .....

As you can see, I've already tried using the empty() function, but that didn't work, the program simply stays in the loop and doesn't break out, no matter how many times I press enter. It just keeps prompting me to enter a name. I've also tried using something like

if (input1 == "")

but that doesn't work either. How do I break out of this loop?

View 1 Replies View Related

C# :: User Control Being Blank On Main Window

Jan 5, 2015

I have followed the tutorial here - [URL] .....

This is a tutorial that I have gone through completely with success, but now I am trying to create a different project using the same sort of setup.

When I add my usercontrol to the MainWindow it has none of the buttons/TextBlocks on which I have put on the UserControls - It is just a blank box. What could be causing this?

I have changed the name of the project to [snip] because it has a company name in it...

"NumericControl.xaml"
<UserControl x:Class="[snip].UserControl.View.NumericControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

[Code] ....

View 14 Replies View Related

C/C++ :: How To Put Element In Blank Cell Of Two Dimensional Array

Oct 2, 2013

I have already data in two dimensional matrix but some cell is empty.Now i want to put 0 in blank cell.

View 2 Replies View Related

C++ :: Outputting Associated Data In Struct

May 2, 2013

So this is the last part of a program I've been working on for four weeks now. This question may be a tough one considering the amount of files included in the program.

The program is to read in a file of requests between two cities, read in a file of flights and cities that occur between the cities. It then checks to see if there is a path between the flights and output an itinerary. I have the correct itinerary outputting, but when attempting to output the associated flight number and price according to the city, I am getting odd data. How can I output the correct flight number and price associated with each flight on the itinerary.

I'll post out the output I am currently getting and the section where I am outputting the data. I'm sure I'll need to post more files so the program can be understood.

Don't want the code done for me, just a point in the right direction! I don't want to let this program defeat me!

Output: Code: Request is to fly from Atlanta to San-Diego.The flight itinerary is:
Flight # From To Cost
10 Atlanta Chicago $134529069
10 Chicago Miami $134529069
10 Miami Dallas $134529069
10 Dallas San-Francisco $134529069
10 San-Francisco San-Diego $134529069
This function finds a path between cities. Code: bool flightMap::IsPath(string originCity, string destinationCity){
StackClass aStack, bStack;
flightStruct flightRec;
string topCity, nextCity;
bool success;
int index = 0;

[Code].....

View 1 Replies View Related

C++ :: How To Pause After Outputting Results

Feb 19, 2013

I mean on the executable file. It just displays the results and quickly flashes away, cin.get() has no effect and system("PAUSE") is undeclared.

I never found a single sure way to pause effectively. Is there a method that works all the time? Sometimes cin.get() gets skipped even in the code itself. The IDE I am using is Code Blocks if that matters any.

View 4 Replies View Related

C++ ::  NCurses Outputting Vectors

May 19, 2013

The following code works perfectly with "normal" C++

#include <iostream>
#include <vector>
int main() {
std::vector <std::string> hello {

[Code] ....

This prints "HELLO" on the screen. A function a bit more like NCurses is:

for (std::vector <std::string>::const_iterator it = hello.begin(); it != hello.end(); it++) {
std::string temp = *it;
std::cout << temp.c_str() << std::endl;
}

This still works with "normal" C++. Now, how do I get this working with NCurses? I tried

#include <curses.h>
#include <string>
#include <vector>
int main() {
initscr();

[Code] ....

But this just gives me an empty screen.

View 2 Replies View Related

C++ :: Outputting Randomized Arrays

Apr 7, 2013

For an assignment I am having a user enter the name of a file that contains "Song Data" the file is set up like this:

(example)

1012 C
3333 R
90 E

And so forth for 15 lines. The first value represents the song Id and the second is a character C, D, E, or R that represents the type of song. After the file is opened I have two parallel arrays that are read from the file:

1. int songId[15]
2. char typeOfSong[15]

I am able to read the entire file, which symbolizes playing the playlist in order, but now I have to play a randomized playlist.

It has been given to us that we need to set up two parallel arrays, that are also parallel to the first two (songId and typeOfSong). These must also be one dimensional. The first array will will be indexes into the songId array telling is what order to put the songs in and the second is an array of true/false values telling us if the song has already been chosen or not.

I have that:

void playRandomPlaylist (int songId[], char typeOfSong[]) {

// the size of the file and therefore arrays is known
rand() % songId[15]

// choosen and notChoosen symbolizing true and false values
typedef enum {choosen, notChoosen};
}

View 1 Replies View Related

C++ :: Comparing Value To Array And Outputting

Feb 6, 2013

i have 3 arrays total, 2 of them i am comparing to see if any of the values match at all, and then i am putting the value that matches into the 3rd array. currently i am trying

int isthere (int match[], int maxmatchLength,
const int vec1[], int vec1Length,
const int vec2[], int vec2Length)
{
for (i=0; i<vec1Length; i++)
if vec1[i]==vec2[i];
vec1[i] = match[i];
}

But this will just match the same values are in the same spot. how do i fix it so that it compares one value in the first array to the whole second array, before going to the next number.

View 1 Replies View Related

C :: Bubble Sorting Failed - Prints A Blank Record

Feb 19, 2014

Well still working on my project, now the bubble sorting failed. For some reason the first slot in the array is empty and when I attempt to enter a record to access, it just crashes or prints a blank record. Here is my code for the viewing of the record and a SS of the empty array slot.

Code:
void searchRec(void) {
void Printing(int *ver, int *max);
FILE *fPtr;
struct Students vStudnt;
int set;
int ver;
int i = 0;
int fin = 0;
int sel;
char order;

[Code]...

Well I don't see why there is a empty slot, why?

View 6 Replies View Related

C++ :: How To Test A Compare Function With Parameter That Is Blank String

Feb 18, 2013

Modify your code by adding your own tests to see if your functions work right. Include at least 6 separate tests, of your choosing.

For example, test the compare function with the first parameter as a blank string -- then with the 2nd as a blank -- then both. Test compare with the first string shorter than the second -- then the other way around. Test your copy function with long strings.

I am struggling with how to use the compare function with a parameter as a blank string. I tried leaving the first parameter blank but doing ("",text) but I don't think that is the correct way of doing this.

#include <cstring>
#include <iostream>
using std::cin;
using std::cout;
using std::endl;

int myStrLen(const char[]); // return length of null-terminated string stored in char array

[Code] ....

View 2 Replies View Related

C++ ::  Program Shouldn't Count Comments And Blank Lines

Feb 7, 2015

My program does compile and counts the number of lines of code, which is LOC: 20. My issue this, according to my code instruction it should not count comments (//) and also shouldn't count blank lines of code. Unfortunately my code is counting // and white space.

What seems to be working is #, all three includes are not being counted. That’s a good sign. I’m using the same technique not to count #. Why isn't working for comments and blank lines? I’m pretty sure that my logic is correct. I think my problem is maybe syntax.

#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main() {
//read my file

[code]....

View 4 Replies View Related

C/C++ :: User Input Returning As Blank When Using Array Of Structures

Feb 14, 2014

I am having trouble returning use input from iterations after the first series of input from the user. My readCourseArray function can only have one parameter and it is information from the structure Student. This information is gathered from a function which is not in the code below because it works fine. I have hard coded a few lines to try to figure out why I am not getting any input after the first pass of the readCourseArray function. I have tried to delete the tempArray in the function after each pass assuming that that could be the issue. But it was not. At least from what I have gathered. I have tried ignoring new line characters which I never really though was an issue but I tried anyways.

I guess what I am asking is: Is my problem coming from the function itself or from my assignment of the cArray to the return tempArray values?

Like I said, the first pass will print out all of the user input (if I put the code in) but all others will return bad values. I did have a do/while to print out the values but it caused the program to crash. I assume because it hit a bad value and needed to break.

#include <iostream>
#include <string>
using namespace std;
struct Student {
string firstName, lastName, aNumber;
int numberCourses;
double GPA;

[Code] .....

View 2 Replies View Related







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