C++ :: Converting One Format To Another?

Apr 7, 2013

I am in a c++ class and my group is having a hard time making this work... It keeps saying that 'fileOne.open' isn't working.

#include <iostream>
#include <string>
#include <fstream>

[Code]....

View 3 Replies


ADVERTISEMENT

C/C++ :: Converting BMP To Strings Of 0 And 1 (Binary Format)

Mar 14, 2014

I want to read a Bitmap file in C language and produce the binary equivalent of it in the form of 0's and 1's.

View 1 Replies View Related

C :: Editing Image In PPM Format

Mar 10, 2014

I'm trying to edit an image by multiplying the red component of each pixel by 10 and leaving the other components (green and blue) untouched. I'm not really sure how I'm supposed to edit the pixels one by one. I have this so far. I think there is something wrong with my ppm header as well. Is there a way to make a ppm header without specifying the bounds so that it conforms to the image you are putting in?

Code:

#include <stdlib.h>
#include <stdio.h>
#define PICTURE_FILE 1
#define MIN_ARGS 2
#define h 768
#define w 1024
void solve(FILE *in_picture, FILE *out_picture)

[Code] .....

View 6 Replies View Related

C# :: Change File Format

Jun 20, 2013

I have installed VS 2010 and VS 2012. VS 2012 uses SqlServer CE 3.5 and VS 2012 uses SqlServer CE 4.0.The problem is that when a project uses a 3.5 file it tries to open it with 4.0 even if the app.config says to use the 3.5 provider. The version of the assembly is pulled right out of the GAC. I uninstalled 4.0 and the reference auto updated its version to 3.5.1. However after installing 4.0 again it changes to 4.0. The error I am getting is that 4.0 cannot open a 3.5 file....they changed the file format from 3.5 to 4.0 and they are not compatible.

View 2 Replies View Related

C :: Printing Of A File In Different Format?

Sep 13, 2013

The requirement is to capture statistics of uuid occurrences for ALIVE/SEARCH/BYEBYE (it can be all 3, combinations of 2 each, or one alone) in a dynamically populated file in run time.

I am able to print all 3 combinations, but not in combination of 1 or 2 e.g.

If my input.txt is like this :

uuid:22314754-a597-490b-8a93-02cfae01036b ALIVE 16
uuid:22314754-a597-490b-8a93-02cfae01036b BYEBYE 8
uuid:22314754-a597-490b-8a93-02cfae01036b SEARCH 8
uuid:50e65653-7525-485d-83bf-d293558c4264 ALIVE 32
uuid:50e65653-7525-485d-83bf-d293558c4264 BYEBYE 8
uuid:50e65653-7525-485d-83bf-d293558c4264 SEARCH 132

[Code]...

Code:

#include<stdio.h>
#include<string.h>
struct uid
{
char uid_val[100];
char state[100];
int temp_count;
int alive_count;
int search_count;

[Code]...

Gives the following output ->output.txt)

Device ID ALIVE BYEBYE SEARCH
uuid:22314754-a597-490b-8a93-02cfae01036b 16 8 8
uuid:50e65653-7525-485d-83bf-d293558c4264 32 8 132
uuid:55076f6e-6b79-4d65-6497-180373763bc1 113 112 111
uuid:T0100203354 1 2 3

I want to generalize the code such that uuid occurrence does not have to be all 3 (ALIVE/SEARCH/BYEBYE), the occurrences can be any combination and code should work. e.g my code gives wrong results when input.txt contains the following:

uuid:22314754-a597-490b-8a93-02cfae01036b BYEBYE 8
uuid:22314754-a597-490b-8a93-02cfae01036b SEARCH 8
uuid:50e65653-7525-485d-83bf-d293558c4264 ALIVE 32
uuid:50e65653-7525-485d-83bf-d293558c4264 BYEBYE 8
uuid:55076f6e-6b79-4d65-6497-180373763bc1 ALIVE 113
uuid:55076f6e-6b79-4d65-6497-180373763bc1 BYEBYE 112
uuid:55076f6e-6b79-4d65-6497-180373763bc1 SEARCH 111
uuid:T0100203354 BYEBYE 2

I am using ubuntu for gcc/g+ compiler.

View 1 Replies View Related

C++ :: How To Convert Characters To Hex Format

Oct 4, 2014

Is my understanding correct?

Ascii 'a' = 61 (Hex)
Ascii '0' = 30 (Hex)

So this is how we convert characters to hex.

Integer 0 = 0 (Hex), because it's not a character but an integer.

View 8 Replies View Related

C/C++ :: How To Format A Calendar Table

Apr 27, 2014

I am trying to format a Gregorian Calendar that accepts only the year as a user input, but I want the display to show 3 months on one row. I can get January to display correctly, but the February and March months do not.

I think my loop inside of my calendar1 function specifically is the issue:

//Is day before Sat? Else start next line Sun.
if ( ( day + daycode ) % 7 > 0 )
cout << right << setw(3);

[Code]......

View 1 Replies View Related

C/C++ :: Format Output Into Columns?

Apr 8, 2015

My output right now is:

Enter first prime numbers that will be used or -1 to end: 20
Twin Prime Number : (3,5)
Twin Prime Number : (5,7)
Twin Prime Number : (11,13)
Twin Prime Number : (17,19)

But what I want is:

1. {3;5} 2.{5,7} 3.{11,13}

4. {17,19}

else if (i - prime_number == 2)
{
cout << "{" << prime_number << ";" << i << "}" << endl << endl;
prime_number = i;
}

View 1 Replies View Related

Visual C++ :: Keep CDialog In 16:9 Format?

Dec 19, 2013

I have a Dialog with a Browser Control and load a Site with a Video, as the Title says, is there any Way to keep a Dialog in the Format of 16:9 Format, in eg. if someone change the Width or Height of a Dialog, the Height/Width should be changed to? To keep this Format permanent?

My first try was in a OnSizing(UINT fwSide, LPRECT pRect) Function but this is not the best way, because any Time i want to resize my Dialog it flickers terribly and i know i make it in a wrong way.

View 3 Replies View Related

C++ :: Getting User Input In Date Format

Oct 26, 2014

So I have a programming assignment which is for getting a user input in the format of m/d/yyyy. This is stored as d/m/yyyy. I have been able to code all the rest of the requirements of the program but the thing that is giving me trouble is this. The year is allowed to go from 1-3000. The format of the displayed date is:

a zero-filled, two-digit day number, a dash, full name of month, a dash, zero-filled, four-digit year.

I am able to use a switch statement in order to get my name of the month. What I am struggling to figure out is the whole zero filled two digit day and zero filled four digit year. From the way the input is store it appears to me that it will be stored as yyyy which means if you were to enter 0001 for year 1 then it should output it as that (this is an assumption based on format). What I don't get is that the day is entered and stored as d which means if you put in 12 how would it be stored. However if you put in 6 to print the output I would need to add a zero and I dont know how to do that either.

Here is the code for getting the input. The function must stay formated this way as per the instructor. The / is stored but ignored hence the char for second and fourth since / is a char

Code:
void getDate (int& day, int& month, int& year){
char second;
char fourth;
cout << "Please enter a date in the format of m/d/yyyy" << endl;
cin >> month >> second >> day >>fourth >> year;
}

View 4 Replies View Related

C :: Generating Histogram Of PGM Format Image

Jul 29, 2014

I need a C code for generating a Histogram with intensities at X-axis and number of pixels at Y-axis from a PGM format image.

View 5 Replies View Related

C++ :: How To Make Tabular Format In STRUCT

Mar 21, 2013

How to make tabular format in STRUCT?

View 5 Replies View Related

C++ :: How To Take Screenshot And Save It In Image Format

Jul 31, 2014

I want to take screen shot and save it in any image format like jpg, bmp, ppm or any other .

View 3 Replies View Related

C++ :: Searching For Email Format And Domain

Feb 26, 2015

I am new to C++ and programming in general. I was wondering if it is possible to use C++ to search for company email formats and domain addresses?

For example, finding the correct format like:

jsmith@carnival.com
or
johnsmith@carnival.com
or
j.smith@carnival.com

Also, if it is possible to find the actual email domain, such as:

@carnival.com
or
@carnivalcruises.com
or
@carnivalcorp.com

View 4 Replies View Related

C++ :: Format For Changeable Size Array?

Jun 22, 2013

I'm making a program that hold a list of strings (commands) in memory, displays it with a GUI and also sends any of these strings to a USB port.

I'm thinking of holding the strings in a vector that is initialized in a class with methods to add or delete strings (commands). Should I store these string in the vector or pointers to string? Or is there a better way?

View 8 Replies View Related

C++ :: Cannot Write As Binary Using Dat Format In Ubuntu

Nov 29, 2014

I cannot write as binary using .dat format in ubuntu, why?

View 5 Replies View Related

C++ :: 2D Array That Display In 10 X 10 Table Like Format

Dec 8, 2014

My homework assignment is to create a 2 dimensional array that displays in a 10x10 table-like format after completing this assignment i must:

a) sum of each row
b) sum of each column
c) sum of every other row (vice versa with columns)
d) add diagonally
f) change the row to columns

what i have so far is

#include <iostream>
#include <iomanip>
using namespace std;
int main() {
const int row = 10;
const int col = 10;

[Code] ....

Furthermore, what ive tried is to do total = total + x[r][c] within (for c= 0...)

But when it is outputted it continues to add the total from before (which of course is a looping error ive made)

How to add and subtract elements within arrays?

View 1 Replies View Related

C/C++ :: Custom Binary File Format

Jul 9, 2014

Development of a custom binary file type? So far all I know is the just the basic structures of the binary file type, I know that structures are involved but the implementation part I have run into walls.

View 1 Replies View Related

C/C++ :: Better Way To Parse And Format Phone Numbers?

Sep 3, 2014

I'm a student. I've complete an exercise where the goal is to parse some user input to output phone numbers using EXACTLY this style (not including the quotes): "1-888-8888".

Some rules that I've set for my parser are,

1) the phone number can be mixed in with other text, e.g. "My number is 38888888" or "1asdfk8888888" and

2) the first number found must be a valid calling code (1-9).

I wanted the parser to be flexible. Is this nesting too deep?

std::string format_phone_num(std::string &s) {
std::string formatted_num = "";
bool call_code_found = false;
short num_count = 0;
for (unsigned int i = 0; i < s.length(); i++)

[code].....

View 4 Replies View Related

C/C++ :: Making A Date Format Input?

Dec 16, 2014

how my code should work is a console screen in which the user enters a date using format dd/mm/yyyy

Regardless of logical errors (checking days if bigger than 31 or negative values or.. etc) My code should be able to validate the following:

- if the user enters a letter, the program should output an error message

- if the user typed the date as 8/2/2014 the program should convert it to 08/02/2014 without returning an error message

Here's my code so far, I really can't find the bugs in it

#include<iostream>
using namespace std;  
main(){
 char d[2], m[2], y[4], br1, br2, dx, mx;
 bool end, nobr1, nobr2;

[code]....

as you notice, I tried two different validating formats in the days and months, unfortunately they both failed..

Here's how my program is outputting so far:

View 3 Replies View Related

C++ :: Reading In Data From File In Certain Format

Nov 22, 2012

I have a multivalued function (created in some other software Mathematica) that looks like f[8.7,5.4]=4.8+8.7*I. In other words it's a complex valued function of two variables. I store the output of this function over a range of parameters in a text file that looks like:

Code:

f[1,2]=9.8+8.7I;
f[4,5]=5.6-5.21I;
.
.

I could store it differently if that is easier, but essentially I just want some c++ code to read this in and store it, either in a vector type structure or Dictionary? (I don't think a double array will work as I don't know how long list of data is in advance).

View 2 Replies View Related

C++ :: How To Print String In Uppercase Format

Feb 17, 2012

I have a problem. I need to print the string called "last" in uppercase format. can you check why my program prints nothing.

Here is the important section of the code.

if (infile.is_open()) // if file was able to open {
string line;
while (getline(infile, line)) {
string::size_type pos1 = line.find(' '); //pos1 is the position of the first space

[Code] ....

View 1 Replies View Related

C++ :: Writing A Custom Filesystem Format?

Apr 12, 2012

How do you write your own Filesystem/Format?

I've always wanted to know how to write my own system for the learning experience. I've worked on simple ones that read from a flatfile of a defined size, but never one that was on a fully formatted drive.

Where do I start? Are there any examples/tutorials?

View 10 Replies View Related

C++ :: Audio Programming (wave Format)

May 31, 2012

I have problem with this code:

Code:
#include <string>
#include <fstream>
#include <iostream>
#include <cstdlib>
using namespace std;
// multiplier
const double MULTIPLIER = 0.0000001;

[Code] .....

It should cut wav files into smaller pieces using text file .lab (the values multiplied by * 0.0000001 gives time in second. For example, i have such file with recorded yes and no: [URL] ..... and such boundaries [URL] .... It all should be in the same folder, then, after puting "yesno.wav" into command line and press enter it should gives 2 files with yes and no words. But it doesnt - i obtained one file with silent and one short sound. The record is recorded by Audacity, default sample rate 44100, default sample format 16-bit.

View 10 Replies View Related

C :: How To Convert Assembly Language In Txt File To S19 Format

Apr 25, 2013

a few pointers in building an assembler in C for a 68hc11 micro controller I'm struggling on a way to convert the assembly language in a txt file to s19 format.

View 1 Replies View Related

C :: Create A File And Save Text In It In PDF Format

Feb 13, 2014

My objective is to create a file and save some text in it. But the twist is that file should be created in pdf format.

I have written following code:

Code:
#include<stdio.h>

Code:
int main() { FILE *fp;
char ch;
fp=fopen("file.pdf","w");
fprintf(fp, "%PDF-1.3"); //to initiate data storage in pdf file
printf(" Enter data to be stored in to the file:");
while((ch=getchar())!=EOF)
putc(ch,fp);
fclose(fp);
return 0;}

Now my file is created in pdf format, but when I open it by double click on it, it is not open and gives the message like: "Error in opening document. This file is damaged and could not be repaired."

View 1 Replies View Related







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