Visual C++ :: Program To Display Values From Data File As Image?

Jul 29, 2014

I am writing a program to display values from a data file as an image. But I can only get a blue screen. Here is a small program resembling my code. what I have missed? I only changed OnDraw function.

Code:
void CColorDisplayView::OnDraw(CDC* pDC) {
CColorDisplayDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
if (!pDoc)
return;
CRect rect;

[code].....

View 10 Replies


ADVERTISEMENT

Visual C++ :: Display Data Of Text File In List View

Sep 24, 2012

I want to display data from text file in list view and in tree view root will be file name, but i dont know how to do it, the problem is with displaying text file data in list view, i don't know anything about that. text file data is very simple. It is just a square matrix of double values like:

21.06 34.06 5.0
12.78 45.25 6.9
12.89 45.98 5.5

in list view i want to display it.

View 14 Replies View Related

Visual C++ :: Project To Display Raw Image

Nov 25, 2012

Used some online code example to put a little project to display raw image. The display does not seem to work.For some purposes, I like this to work with a dialog based MFC project.XDVView is derived from CScrollView.

See OnInitDialog() and OnDraw(CDC* pDC).8bit 768x756

View 14 Replies View Related

Visual C++ :: Covert Raw Image Data Into PNG

Sep 23, 2013

I have the raw image data and now want to convert it to PNG image. How can i do that? The raw image data is stored in a unsigned char *.

I know how to convert it to Bitmap, but how to convert it to PNG.

View 2 Replies View Related

Visual C++ :: Display Values Of 2-dimensional Array

Aug 31, 2013

1.Create one 2-dimensional array. The array will consist of numbers from 1 to 10. And will also contain the number in words. Display the values of the 2-dimensional array.

Sample output:
1 - One
2 - Two
3 - Three

Paste the program code here:

2.Create a program that will accept two integer numbers. These integer numbers will be the limit of the multiplication table. Store the values in a two dimensional array.

Sample output:
Enter x: 3
Enter y: 2
123
246

Paste the program code here:

3. Determine the output produced by the following program segment.

int ROWS = 3;
int COLS = 4;
int [ ] [ ] val = {{8,16,9, 52},{3,15,27,6},{14,25,2,10}};
for (int i=0; i < ROWS; i++) {
for (int j= 0; j<COLS; j++)
System.out.print (val [i][j] + " " );
System.out.println ();
}

Write the Output:

View 6 Replies View Related

Visual C++ :: Program That Get Data From DAT File

Mar 5, 2014

I am currently writing a program that grabs information from a .dat file. When I go to debut I get this error.

Code:
#include <iostream>
#include <string>
#include <fstream>
using namespace std;
// function step 1 - declare the prototypes
void sort(int n); // catches an integer number from the call
void swap(string *p1, string *p2); //catches the location of data in ram

[Code] .....

View 5 Replies View Related

C/C++ :: Display Data From File Into 2D Array - Print Closest Bmi From Data

Mar 28, 2015

#include <iostream>
#include <fstream>
using namespace std;
int main() {
int r = 0;
int c = 0;
int num[17][15] = { 0 };
[Code] ...

// Here is my code for displaying the data from the text file into a 2d array and height next to it, but I am not able to diaplay the height from 60 to 76 next to the row of the 2d array, as shown in the table below. This is my program:

Recently the health authorities have listed a new way to calculate the body mass index (BMI) of an individual.
Values of 20 – 24 are classified as normal, 25-29 as overweight, and 30-34 as heavy.

The table below is a portion of a typical BMI table.

BMI:202122232425262728293031323334
Height:
60102108113118123128133138143149154159164169174
61106111116122127132138143148153159164169175180
.
.
.

MY task is to write a program that does the following things:

1.Produce the table by reading in the data from bmi.txt (on Moodle) into a 2-D array.

2. Display the table neatly on the screen, with row and column headings. The BMI should go from 20 to 34. The height should go from 60 to 76 inches.

3. Prompt the use for their height (in inches) and their weight.

4. Make the program print the closest BMI.

If their weight is lower than the values on the table, use 20 as the BMI.
If their weight is higher than the values on the table, use 34 as the BMI.

5.Loop the program so the user can find more BMI’s.

View 7 Replies View Related

C :: Display Current Time And Date In Program And Use Variable To Store Each Of Values

Feb 16, 2013

i need to display the current time and date in my program and use variable to store each of the time values like

a = 10
b = 29
c = 31

printf(``%d : %d : %d``, a,b,c);

which then give the output as - 10:29:31

How to save the time in variables in C....

i am using C in windows 7 and my complier is Bloodshed Dev C++

View 7 Replies View Related

Visual C++ :: Program To Resize Image?

Feb 19, 2013

I am currently working on problem set 4 for Harvard's online CS50 course. I am working on a program that resizes a bmp image by a factor of N. N in entered along with an in-file and out-file in a command line argument. The program needs to calculate the header file for the out-file and write it to the out-file. It then needs to actually resize the image and, again, write to the out-file.

The first question I have relates to the header file, here is my code for calculating the header file:

bi2.biHeight = bi.biHeight *n;
bi2.biWidth = bi.biWidth *n;
int padding = (4 -(bi.biWidth * sizeof(RGBTRIPLE))%4)%4;
bi2.biSizeImage = (bi2.biWidth * sizeof(RGBTRIPLE) + padding) * abs(bi2.biHeight);
bf2.bfSize = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER) + bi2.biSizeImage;

And here is my code for writing the new header file (bi2 and bf2) to the out-file:

fwrite(&bf2, sizeof(BITMAPFILEHEADER), 1, outptr);
fwrite(&bi2, sizeof(BITMAPINFOHEADER), 1, outptr);

At this point I need to actually resize the image. As far as I can tell there are 2 ways to go about this you either have to use an array to store each line you want to print repeatedly (and then you can just write it repeatedly) OR you have to move the pointer back in the input stream and repeat the read/resize/write process each time you need to print the row.

It is this that I am stuck on, first of all, I am not sure what system would be better for resizing the image, although I am leaning towards using an array, and regardless, I don't even know where to begin when in implementing either.

So what I am asking for is, first of all, just a "double check" to make sure my header code makes sense. And second of all, a push in the right direction for actually resizing the image. Here is my complete code:

/****************************************************************************
* resize.c
*
* Resizes a BMP piece by piece, just because.
***************************************************************************/

#include
#include
#include "bmp.h"
int main(int argc, char* argv[]) {
// ensure proper usage
if (argc != 4) {
printf("Usage: copy N infile outfile

[Code]....

View 7 Replies View Related

C :: Get Code To Display A Table With Values From A File

Feb 20, 2015

get my code to display a table with values from a file. my current code fills up all the sections of the table with the same data. here is what I need: from a file .txt I upload numbers that should show a table like this :

Lake Beach Average E-Coli Level
Recommendation
Ontario Kew Beach 47.12 OPEN Huron Goderich 51.13 CLOSED Simcoe Sibbald Point 0 INSUFFICIENT

my problem is in the last two columns. The ave. E-coli has one value for all which should look like the above table but my code doesn't. Also my recommendation shows the beach # instead of open close or insufficient.the data is:

Lake table
1: Ontario
2: Erie
3: Huron
4: Muskoka
5: Simcoe

Beach table
100: Kew Beach
101: Sunnyside Beach
103: Sandbanks
201: Port Dover
202: Port Burwell
203: Crystal Beach
301: Goderich
302: Sauble Beach
303: Kincardine
401: Muskoka Beach
501: Sibbald Point
the .txt file contains the following data:
1 101 5 66.6 33.3 22.2 98.9 11.1
5 501 2 33.3 44.3

now this is my code:

Code:

#include <stdio.h>
#include <math.h>
int main(void)
{
FILE *in;
}

[code]......

fix the two last columns so the correct info shows like the table above.

View 3 Replies View Related

C++ :: Scanning A Header File To Save Image Data

Jun 11, 2013

I'm trying to read from a header file to take the image dimensions and other variables but I don't understand how to iterate through the "key" so it saves each line.

This is what the header file will always look like:

!INTERFILE :=
!imaging modality := nucmed
!version of keys := 3.3
;
!GENERAL DATA :=

[Code].....

Ideally it would just skip the keys that aren't wanted and keep moving through the lines. Should there be a for loop for the key (and if so, how does that work with pointers?) or should this method just be scratched...

View 6 Replies View Related

C Sharp :: How To Access Raw Image Data In Resource File

Nov 14, 2012

I have a .png file that my console app reads and puts into a structure that is saved as a file. The png is always the same so I thought I could just add it as a resource image to a resource file so it would be included in my program and not as a separate file. When I did that, the png shows up as a "SystemDrawingBitmap". If I examine this resource in a watch I see "Base" and "Static" members. Expanding those properties does not give me anything useful such as a pointer to the raw png data and its length in bytes.

If worse comes to worse, I can always make a hex dump of the png contents and then put the hex code into a CS file using static initialization.

Surely there is some way I can access the raw data internally and read the bytes into a byte array using C#

View 2 Replies View Related

Visual C++ :: Display Data Immediately - Dialog Domodal?

Mar 24, 2014

I haven't seen it anywhere and I've been looking. Is it possible to display data, say in a CEdit field in a dialog as soon as the dialog starts? Either before or after DoModal is fine.. These are essentially the same.

Using Visual Studio 2013 - trial version. It's nice. Coming from VC6. Many things are familiar (so far), at least in the C++ part.

View 7 Replies View Related

Visual C++ :: CString - Display Some Data In Text Format On A Dialog

Aug 7, 2014

I am trying to display some data in text format on a dialog and I am using a CString to do it. Below is how I coded it.

Code:
CString outputStr;
CString auxStr;
// Add header
outputStr.Format("");
auxStr.Format("%-7s%-20s%-7s%-20s%s

[Code] .....

But the output rows are not aligned as shown in the attached picture. There a two problems.

1. Data rows don't align with the header row.
2. When the first element of a row changes to two digits, the other elements are shifted.

According to MSDN [URL] ...., CString::Format() works the same way as printf(). I wrote a small program using printf() to do the same thing, and the output in the console are perfectly aligned.

What have I missed when doing the display in GUI?

View 14 Replies View Related

Visual C++ :: Reading Image File?

Apr 26, 2013

I have a jpg file. I have extracted the width and the length of the image. I have done that with some codes and markers. Now I need the image data starts as from that place i would like read the data and print the pixel value. I would like to display the pixels later.

View 2 Replies View Related

C :: How To Display Data From A File

Feb 24, 2013

I'm trying to display data from a text file named ace_data.txt. Here's a preview of the first three lines i want to display:

2001 106 15
2002 65 12
2003 175 16

So basically, here is what my code looks like...

Code:
#define FILENAME "ace_data.txt"
int main (void) {
FILE *inp,
*outp;

[Code] ....

And nothing is displayed when i run the program. I feel like I made some mistake with the fopen() and fscanf() functions but I'm not so sure how to correct them.

View 4 Replies View Related

Visual C++ :: Unable To Read LCT File To BMP Image

Nov 20, 2014

I have an *.lct file. I like to read *.lct file and save an bmp image.

I can not read this file using usual file read.

Code:

void CLCTtoBMPDlg::OnBnClickedReadlctfile() {
CFileException CFileEx;
CStdioFile ReadFile;
CString OpenlctfilePath;
TCHAR szFilters[]= _T("LCT Files (*.lct)");
CFileDialog fileDlg(TRUE, _T("bmp"), _T("*.lct"), OFN_FILEMUSTEXIST | OFN_HIDEREADONLY, szFilters);

[Code]...

Find the attachment. change the file extension *.lct instead of *.txt. I like to read ASCII Data into Hex, Example : Data "A" as "41" (Refer the jpeg image). How is possible?

View 4 Replies View Related

C# :: Compare The Image Of A Button To Another Image In Visual Studio

Jul 3, 2014

Im trying to compare the image of a button to another image in Visual Studio like so...

//variables
Image active = Image.FromFile("C:\Users\Ethan\Desktop\StarWars Status\active.png");
Image stunned = Image.FromFile("C:\Users\Ethan\Desktop\StarWars Status\stunned.png");

[Code]...

btnStatusPlr1.Image SHOULD come back as True.Then I realized it might not be the same as setting the buttons image in the properties (Which is what i did to get the original image (the one being compared to))

I do have a feeling ive done something wrong here (Yes im a noob /> )

Variable active, is the same image as the buttons default (Well should be)

View 1 Replies View Related

C++ :: Read A File Into 2D Array And Display Data

Nov 15, 2014

I am currently working on a problem where I read a file into a 2D array, and display data. If you saw my code earlier, this is the same problem, but I am now further along.

The file (90 characters) looks like this:
S
R
R
S
R
R
R
R
S
S
....

The "R" resembles rainy days, the "S" resembles sunny days, and the "C" resembles cloudy days. There are 90 characters in the file. The first 30 are for the month of June, the next 30 are for the month of July, and the last 30 are for the month of August. The 31st day of the months are NOT included.

I read the data into a 3 x 30 array, where the row indicates the month (0 = June, 1 = July, 2 = August) and the column indicates the number of days in each month.

Now I need to create a function that creates a report and displays, for each month AND for the whole 3 month period:
1) The number of rainy days
2) The number of cloudy days
3) The number of sunny days
4) Which of the 3 months had the largest number of rainy days

Here is my code so far:

#include <iostream>
#include <fstream>
#include <string>
using namespace std;
const int MONTHS = 3;//Number of months

[Code] .....

There are no compiling errors, but I am not getting the data I want. My rCount and cCount variables end up being 0, and my sCount variable is 90.

View 4 Replies View Related

C :: Cannot Display Data Written To File In Switch Statement

Mar 18, 2013

i cant display the data written to this file in a switch statement (case 2) what am i doing wrong..the file data is being written into the text file but i cant display it

insert
Code:
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
FILE *fp; //creates a file pointer
typedef struct date_info

[Code].....

View 8 Replies View Related

C :: How To Display Image With Text

Mar 27, 2013

I'm pretty new to C, just looking to see how to display a image and some text to go along with it so far I can display in the image but cannot display the text at the same time.

This is my source code below

Code:

#include <stdio.h>
#include <gd.h>
int main() {
gdImagePtr gdImage = gdImageCreate( 100, 100 );

[Code]...

View 2 Replies View Related

Visual C++ :: TCP/IP Program - Display All IP Addresses That Are Connected To Client

Mar 12, 2013

I need to create a TCP/IP program using visual studios MFC that displays all client's IP addresses that are connected to the client.

The MFC application just has a list box and a button. The client can be a simple console application. When the button is clicked, the list box gets populated with all ip addresses of connected clients.

View 14 Replies View Related

C++ :: Read Data From A File Then Store / Search And Display Using Classes And Arrays

Apr 12, 2013

A company uses two text files: one to store employees' details and another to log their sign in/out time.

The details file - called details.txt" has the following format: ID, Name, Date of Birth, SSN, Department, Position - separated by spaces.

An extract from the file looks like this:

10 alice 4/23/1972 123-45-6789 support assistant
3 bob 6/7/1980 111-12-1134 logistics manager
1 carol 10/2/1963 987-123-1143 admin ceo
2 dave 10/3/1974 902-22-8914 admin cfo
17 erin 6/13/1991 126-83-1942 technology supervisor
15 frank 2/22/1987 303-12-1122 logistics assistant

"timelog.txt" contains daily logs of when employees arrive and leave. It has the following format: ID, Date, Arrival Time, Departure Time - separated by spaces. An extract from the file looks like this:

10 2/11 0900 1700
3 2/11 0930 1730
1 2/11 1100 2000
2 2/11 1000 1530
17 2/11 0900 1700
10 2/12 1000 1830
3 2/12 0930 1730
1 2/12 1100 1900
2 2/12 1030 2000
17 2/12 0900 1700
15 2/12 1100 1600

I have to write a program that searches for specific records using some search parameter, and displays them. Ok first i have to read the data from the files and store them. this is what i have so far....

#include <iostream> //Accesses libaries for console input and output
#include <fstream> //Needed to access the fstream object to read files
#include <string> //Needed to access the string class
#include <cstdlib>

[Code] ....

I know my class and array code is totally wrong i dont know how to store the data for the info is in integer and string form... do i use strings, arrays?

View 1 Replies View Related

C++ :: How To Display Image On Output Screen

Nov 21, 2013

how to display an image on the output screen of c++ program.

I am using : Turbo c++(dos box) on win8

View 1 Replies View Related

C# :: Display Average Value Of Pixels In The Image

Feb 4, 2013

I have a project which opens an image in PictureBox1, no problem. But the Public Static Color method at the bottom of the code is not working. I was hoping it would display the average value of the pixels in the image. why it is not working?

Code:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing.Imaging;
using System.Drawing;

[Code]...

View 2 Replies View Related

C++ :: How To Insert Image To Display In Output

Sep 17, 2013

how to insert an image to display in output on c++..

View 3 Replies View Related







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