C++ :: Opening Files In Hex Mode To Compress File Size

Sep 10, 2014

I have an idea which i will try to implement in C++,I want to compress file size through making my own numbering system which is 80-based number, I do really want to know whether this even possible ? I learnet that Hexadecimal uses symbols like A, B, C, D, E, F to represent 10,11,12,13,14,15 -- and that's what i want to do to my own numbering system but in a bigger scale .if possible: How can i use C++ to open a file in Hex mode ?

View 6 Replies


ADVERTISEMENT

C# :: Drag And Drop From Windows Compress Files?

Jun 25, 2014

I've been looking for some examples of handling dropped files from within a Windows compressed folder? I suspect, ultimately I may need to identify that it is a compressed folder and extract the contents, however I have not been able to find any information about identifying the file that may have been drug out of the folder onto the form (such as the file name, zip file path etc)

View 14 Replies View Related

C++ :: Opening And Reading Files With Input / Output?

Oct 15, 2014

I'm in a CIS 143 class which is Introduction to Programming using C++. We've been assigned a lab with little to no detail on how to do the things listed.

The purpose of this lab is to practice the file input and output concepts. For this lab you may assume that the input files exist and contain appropriate data inside of them.

Four separate text files* which contain the following lines, different for each file.

(*: This isn't on the lab, but don't worry about what the name, age, id, and major are. those can be random and I can just change them what they need to be)

Name
Age
Student ID Number
Major

Your program should ask the user which of the four input files they would like to open, and then read the contents from the file. Once the contents have been read in, it should output to both the screen and a file named "output.txt" the four values were read in, arranged as follows:

"Hello <name>! You are a <age> years old <major> student, and your ID number is <ID number>"

Now I am by no means saying "Do it for me". I just need to know how to have a user type file1, file2, file3, or file4, and then have the program open that file, then have the output.txt file arrange the wording into the sentence above.

This is what I have so far and I don't think it is anywhere near correct:

#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main() {
ifstream inFile;
string file1;
string file2;

[code]....

View 1 Replies View Related

C Sharp :: Opening And Importing Multiple Files Into DataGridView / Database

Mar 29, 2013

I'm trying to add a function now that lets the user open 1 or more files and import them to the database and dataGridView. Now the way it is now (should) work. But when it has finished with FILE1, it won't add FILE2 as it then gives me an error that the Column Date Already exists.

My code is below

private void btnOpenLog_Click(object sender, EventArgs e)   {
            OpenFileDialog openFileDialog1 = new OpenFileDialog();
            openFileDialog1.Filter = "Log Files (*.log)|*.log";
            openFileDialog1.Multiselect = true;

[Code] .....

View 12 Replies View Related

C++ :: Delete Files With Same Size

Apr 28, 2013

So, i got a directory full of files. Some files are duplicate and i'd like to delete those duplicate files. The only way to recognize duplicate files is their size. So how would i delete them?

View 4 Replies View Related

C :: Reading Files Of Unknown Size

Jan 23, 2013

I want my program to be able to read text files in the format:

number number
number number
number number...

and so on, so there are two columns of values. The problem I'm having is, there are a lot of numbers in the file, and it can vary. The program needs to read the numbers, put one column into one array, and the other in another, perform some operations on it all, and eventually pop out two different arrays. In other words, after I've got these arrays, I don't need them for much longer. I was hoping I could dynamically allocated some arrays to store the numbers and just free them as soon as I'm done with them.

If the file wasn't of such variable size or if it was guaranteed to be under a certain number of variables, I would have used:

Code:

while ( fscanf(input, "%lf %lf
", &col_1[], &col_2[]) == 2 )
{
no_rows++;
}

The problem is I want to allocate "no_rows" as the array size, which I don't have until after I have read the file.

View 9 Replies View Related

C :: Opening A Data File Or Not

Jul 18, 2013

I have attempted a couple of different times to open a .txt file in a program, however it always goes to the "file was not opened."

Code:

#include <stdio.h>
#include <stdlib.h>
int main()
{
FILE *inFile;

[Code]....

View 8 Replies View Related

C++ :: Opening A File Within A Directory

Apr 26, 2013

I have problems opening a file within a directory.

#include <dirent.h>
#include <string>
#include <vector>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

[Code] .....

Error Message:
$ ./dirsearch ~/Documents/College/textfiles/
[..]
[yomama.txt]
Error : Failed to open entry file - No such file or directory

Here are my current file permissions:
textfiles$ ls -l
total 8
-rw-rw-rw- 1 jav jav 7 Apr 26 13:14 moretext.txt
-rw-rw-rw- 1 jav jav 10 Apr 26 12:38 yomama.txt

View 6 Replies View Related

C++ :: CPP File Not Opening Correctly?

Nov 2, 2014

When I try to open the cpp source in Visual Studio, it just opens a blank notepad window. The cpp file says its 4 kb and there was code in it.

View 5 Replies View Related

C/C++ :: How To Print PDF File Without Opening It

Feb 21, 2015

I would like to know what is the best compiler for a very simple program. I'd like to be able to print a pdf file without opening it.

View 3 Replies View Related

C++ :: How To Tell If File Is Locked Without Opening

Dec 11, 2013

I need to find if a file is locked, but I dont want to open the file as I will be checking 1000's of files.

can I do that in C++ or VC++

View 10 Replies View Related

C :: Opening A File For Read Only On Screen

Apr 4, 2013

How to open a file and just print what is in that file on the screen. I though maybe I had the directory wrong but putting G: or G: give me the same result. When I select 1 it just goes to the next line and doesn't print anything.

Code:
int getchoice(void)
{
int num;
int choice;
FILE* outputfile;

[Code] ....

View 12 Replies View Related

C :: Opening Audio File Using Language

Sep 6, 2013

how to open an audio file using c. write a code to open an audio file.

View 2 Replies View Related

C :: Opening File - Read / Write

Aug 5, 2013

this is my read/write functions based the read from the last post! then went nuts with it! used the %19s%*s on the write to the file, solved all the probs on the read side! but any refining on this would be great. This is another program that i started with the forums, and started going my own direction!

Code:

void WriteAccount(int account,char *a[])
{
FILE *fptr;
char Memo[20];
char buff[20];
double Amount;
struct tm *sTm;
}

[code]....

the a[] is a string array with bank account names, and Account is the number on the menu based list.

View 7 Replies View Related

C :: Opening File And Copy String To That In Other

Jun 22, 2014

I am getting an error when i try to open FILE which user must enter then program must open that file i an function and copy string from that file in other .

Error is expression (stream !=NULL)

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

void FileCopy(char a[],char b[]);
void main() {
char a[40],b[40];

[Code] ....

View 8 Replies View Related

C++ :: Opening File Using Variable (Char Or Int)

Mar 14, 2013

Can we open a file in c++ using a variable(either character or int)?

View 1 Replies View Related

C++ :: Opening A File In Void Function

Feb 26, 2013

how do you open a file inside of a void function

this is the code i have

#include <iostream>
#include <fstream>
#include <sstream>

[Code]....

View 6 Replies View Related

C++ :: Opening User Input File Name?

Jun 17, 2013

why this is looping in an error message. I am inputting the entire file name when I run the program and it just keeps falling into my "if(!inputfile)" statement. Let me know if there is anything I'm just not seeing.

#include "File.h"
#include <iostream>
#include <fstream>
#include <string>

[Code]....

View 3 Replies View Related

C++ :: Error Opening File In Input

Nov 8, 2014

ofstream infile;
infile.open("Input.txt");
if(infile.fail()) {
cout << "Error Opening File in Input" << endl;
system("pause");
exit(1);
}

So I'm trying to see if it fails, but if i change "Input" name would the computer just create a new file name of it for example if i change "Input" to "asdf" the computer is just going to create "asdf" how do i fix it.

View 4 Replies View Related

C++ :: Opening And Reading Text File

Nov 6, 2013

My project includes opening and reading a text file ("customers.txt"). This is my text file:

6
Joe
P 10.02 Y
Mary
r 15.50 N
Dan
U 19.00 y
Victoria
R 6.50 y
Nick
n 0 Y
Vigo
p 18.27 N

I wrote this code, but it seems not to find the text file.

#include <iostream>
#include <fstream>
using namespace std;
int main() {
ifstream inputFile;
int number;

[Code] ......

View 6 Replies View Related

C Sharp :: Opening A File By Using The Extension?

Apr 24, 2013

The code below is used to return a file path.

 private string BrowseJournalFile(string startRelativePath)
        {
            string str = "Journal files (*.log)|*.log|All files (*.*)|*.*";
            return PathTools.BrowseFile(startRelativePath, str, this.RootPath);    
        }

So once I click browse I get something like "E:New Files" But there is this .log file in this folder which I want to automatically store in this path.

Right now I have to click on this .log file and then select open. Is there a way I can directly load the file.I have been trying to use the FileStream but no luck.

View 7 Replies View Related

C++ :: Wfopen And Fopen Not Opening File

Mar 16, 2012

_wfopen and fopen don't open exist file... File name I viewed during debugging

Code:

wchar_t *CurrentDir = new wchar_t[512];
GetModuleFileNameW(NULL, CurrentDir, 512);
int sz = wcslen(CurrentDir);
for (int i = sz-1;;i--) {

[Code] .....

View 13 Replies View Related

C/C++ :: Error Handling For File Opening And Reading

Apr 23, 2014

I am writing to write a program and performs the following tasks

- Reading a file (txt file contains some temperature values)
- Display the temperature values (contents of the file)
- Calculating the average of the temperature values in the file.
- finds the maximum and minim value of temperature in the file.

The program is user interactive and waits for the user input and process according to his input (choice)

I have managed to complete the program and covered all the expect except the error handling for file opening and reading, although I have managed to do it for the part one part (i.e for the choice == 1)

I can repeat it for the other choices (i.e for 2, 3 ) but I do not want to repeat the code and do it in a different function or do it once for all. While making an attempt I can not handle the rest of the program and all the program turns into a mess.

#include <iostream>
#include <fstream>
#include <iomanip>
int menu();
int myChoice(char);
char inputValidating();

[Code] .....

Need Error handling for file opening and Reading that is used once, So far I have managed to do it for choice 1

Text file can be found in the attachment

View 3 Replies View Related

C :: Compress Array Of Characters

Mar 15, 2014

I am trying to write a function compress() that takes in an input of a 2-dimensional array (5x10) of character data, compresses each row of the array by replacing each run of character with a single character and the number of times it occurs, and prints on each line the result of compression in the function. For example, the row with data aabbcdddee may be compressed into a2b2c1d3e2.

Input (5x10 of characters):
aaacccdeee
sssseeeedd
aaaaaaaccc
eeedddasee
ddeeeeeggg

Output:
a3c3d1e3
s4e4d2
a7c3
e3d3a1s1e2
d2e5g3

I could achieve the compression part, but behind the compressed array, it printed out 5 extra lines of alien ASCI code, followed by printing out 5 times of everything .

Code:

void compress(char data[SIZE1][SIZE2])
{
int i,j, k,l ,count;
char data123;
printf("Enter your data (5x10 of characters): ");
for (i=0; i < SIZE1; i++) {
for (j=0; j < SIZE2; j++)
data[i][j] = getchar();
fflush(stdin);
}

[code]....

View 3 Replies View Related

C++ :: Compress 2 Way Sideways Scrolling Shooter?

Mar 5, 2013

You are programming a sideways scrolling shooter. This used 2D cell based maps that are very long (over 100,000 characters per row long, 24 rows of 40 characters on screen), and the only way you can get them to fit in memory is to compress each row of the map using run length encoding and to decompress each new column of the map on the right of the screen as the background moves from right to left. You maintain a list of pointers into the RLE data for each row of the screen. Columns that are scrolled off the left are discarded. This works very well and the game only just fits in the available memory. Suddenly the game designer decides that the game should also be able to scroll from left to right at any point, and for any duration. Stunned and dismayed, you explain to him that RLE compression only works in one direction, but he’s adamant. Figure out a way of doing what he wants without using much (no more that 1K of) extra memory. Explain the algorithm used for decompressing in both directions. (assume the RLE algorithm used is: a positive byte N followed by a byte B, indicates a run of N copies of B, a negative byte -N followed by N bytes indicates that those bytes should be copied directly. For example, the sequence 2,2,2,2,5,1,2,9,9,9,9,9 would be coded 4,2, -3,5,1,2, 5,9.)

how can I compress the information? My first thought was making a change to the RLE compression but i gave up on that thinking it wasn't possible.

View 2 Replies View Related

Visual C++ :: Opening A File From Local Path - GetStatus Failed?

Aug 1, 2013

I am trying to open a file from local Path by the follwing code

CString csRegExtractFileRemote;
CFileException ef;
CFileStatuscfsStatus;
CFile cfSAP;
csRegExtractFileRemote = "c:SWRemoteFilesample.txt";

[Code] ....

Compilation is success full ,but i am observing that some junk value is there in the path variable. After Reaching If statement cursor went to final return statement ...

View 2 Replies View Related







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