C :: Find Darkest Point In PPM File Using RGB

Mar 31, 2014

I have write a program to read ppm file and write a new ppm file. However, I'm not sure how to find the darkest point in this ppm file.

Note:
1. there are 610200 RGB point, but my new file only created 176196 RGB point.
2. RGB range: 0-255. (0,0,0)= black; (255,255,255)= white
3. When reporting the location of your dark pixels, assume the upper left corner of the image is location 1, 1

Below is my code:

#include<stdio.h>#include<stdlib.h>
typedef struct {
unsigned char red,green,blue;
} pixel_t;

typedef struct {
int x, y;
pixel_t *data;
} PPMImage;

[Code] .....

Here is ppm file: [URL] .....

View 10 Replies


ADVERTISEMENT

C++ :: Error 453 - Can't Find DLL Entry Point

Nov 7, 2013

Using VC++ 2010 Express. I am creating a dll to export a simple Multiply function so I can use it in Excel/VBA

These e are the steps I am following :

. Create a Win32 C++ Project and give a name. For example: CallDllFromVBA
. Select the DLL option in the Wizard and click Finish
. In the CPP file (here CallDllFromVBA.cpp), add the following code

#include "stdafx.h"
int _stdcall Multiply(int x, int y) {
return x * y;

[Code] ....

The Build output show everything is ok as follows :

CallDllFromVBA.cpp
CallDllFromVBA.vcxproj -> c:documents and settingsadministrateurmes documentsvisual studio 2010ProjectsCallDllFromVBADebugCallDllFromVBA.dll
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

In VBA, I insert a module and add the following code:

Declare Function Multiply Lib _
"c:documents and settingsadministrateurmes documentsvisual studio 2010ProjectsCallDllFromVBADebugCallDllFromVBA.dll" _
(ByVal x As Long, ByVal y As Long) As Long
Sub test()
MsgBox Multiply(2, 4)
End Sub

When I run the Test sub I get the error: 453 - Can't find dll entry point

I also opened the CallDllFromVBA dll with Dependency walker and I can't find the Multiply export function - In fact, the dependency walker doesn't show any function exports at all for the CallDllFromVBA dll !

View 2 Replies View Related

C :: Function To Find Starting Point For Recursive

Mar 6, 2015

I am trying to create a function to find the entry point of my map.But my program does not seem to be working correctly. I am trying to place a dot there because I will have to use recursion to fill up the whole map. But I'm not asking for the answer. I just need writing a function to locate the starting row for the first column of the maze (first non zero element). My code seems to have a bug in it when I try and call my function FindEntry. What I am trying to do is read in column by column until I can find the starting point and then place a dot there with ASCII character 249. This is my code so far:

Code:
#include<stdio.h>
#include<Windows.h>
#define HEIGHT 21
#define WIDTH 78

[Code]....

If you try and run it, it will give you a bug. But if you comment out the FindEntry function in the main it will work and look like this:

View 7 Replies View Related

C/C++ :: Find Angle And Radius Of Given Point Of A Circle

Oct 7, 2013

Let (x,y) be the center of the circle. (x,y) will not be (0,0). I have radius of the circle. Now i want to find the angle and radius of the given point inside the circle.

View 2 Replies View Related

C :: How To Change MPI Broadcast Into Asynchronous Point To Point Communication

Jun 26, 2013

I have one code that use MPI broadcast and I want to change it into Asynchronous Point to Point communication. I am newbie in Parallel programming. Looking for implementation of one simple same program in broadcast and P2P ?

View 6 Replies View Related

C++ :: File I/O - Entry Point For Console Application

Aug 1, 2013

I am stuck in visual studio 2010 file I/O ... i placed file1 file2 using the following program under VS2010/projects/projectname/file, file1 and also in debug also once......I am actually using cmd line arguments in debug mode

Code:
// feof files.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
int main(int argc, char* argv[])

[Code] ....

I dont think in C++ forum the printf will do any problem...when i run the program it says "cannot open source file" and a window appears saying"Debug assertion failed"....and other details such as Expressionstream!=NULL).perror

View 4 Replies View Related

C++ :: Binary File - Replace Data At Specific Point?

Nov 28, 2014

I'm making a binary file that has 100 "empty spaces", and then I want to rewrite specific place with info, however it always writes the info at the end of the file, no matter what I try to get position before I call write() it tells me correct position...

#include <Windows.h>
#include <iostream>
#include <string>
#include <fstream>
#include <vector>

[Code].....

View 5 Replies View Related

Visual C++ :: Address Of Entry Point In Binary File?

Dec 28, 2013

How can I find/calculate the address of the entry point for an exe binary file using its PE32 optional header?

I have added a picture, where it says (file addr) thats the address I want to know how to calculate

View 2 Replies View Related

C++ :: How To Count Total Integer And Floating Point Numbers In Text File

Feb 16, 2013

I have a text file like below read.txt:

1.0 2.0 3.0 4.0
2.0 3.0 4.0 6
5.0 7 1.0 5.0

calc.cpp:

void main() {
FILE *fp;
fp=fopen("read.txt","r");
double *read_feature = new double*[3];

[Code] ....

I want to count all the numbers in my text file (read.txt). Read text file consist of floating and integer number. Answer for the above file would be integer=2 and float =10.

View 3 Replies View Related

C :: Reading From A File And Skipping Lines To Find String In File

Nov 26, 2013

Program background: Ticket Sales Details You will sell tickets in advance and at the door. Prices for buying in advance and at the door will be given. Also, the total number of tickets sold in advance will be given. Each guest will have a unique number. If there are n tickets sold in advance, then these guests will be numbered 0 through n-1. As the event starts, requests to buy tickets at the door may be made and these guests will be numbered sequentially, starting at the lowest unassigned number. The maximum number of guests will be 1000. The first line of the file contains the following three values, separated by spaces: Cost of the presales tickets (in dollars), Cost of the tickets at the door (in dollars), and the number of presale tickets. The first two values will be positive real numbers to two decimal places and the last will be a positive integer.

The second line of the file will contain one positive integer representing the number of auction items followed by a positive real value to two decimal places (at most) representing the minimum bid increment, in dollars. The first value is guaranteed to be 1000 or less and the second will be in between 1 and 50, inclusive.

The third line of the file will contain all the prices of the auction items, in dollars, separated by spaces, in order. Thus, the first price is the price of item 0, the next price is the price of item 1, and so on. These values will be real numbers represented to up to 2 decimal places.

The fourth line of the file will contain the three following positive integers pertaining to the raffle: the number of raffle tickets available, the cost of a raffle ticket in dollars, and the number of raffle prizes. (It's strange to have raffle tickets that don't cost a whole number of dollars.)

The fifth line of the file will contain each of the values of the raffle items, in dollars, separated by spaces, in order. Thus, the first price is the price if item 0, the next price is the price of item 1, and so on. These values will be real numbers with upto 2 decimal places.

The sixth line of the file will contain ten positive integers representing the number of each of the drinks 0 through 9, in order, that are in stock.

The seventh line of the file will contain ten positive real numbers with upto 2 decimal places representing the price of each of the drinks 0 through 9, in order.

The eighth line of the file will contain a single positive integer, numEvents, representing the number of events that occur at the charity ball. These events are split into two groups: actions by guests at the ball and awards given (raffle, auction, person, totalrevenue). All of the actions precede all of the awards. You will produce exactly one line of output for each event described. Here are the formats of each event that could occur:

If a patron buys a ticket at the door, a command will be on a line by itself:

BUY TICKET k

where k is a positive integer indicating the number of tickets bought at the door. These guests will be numbered as previously mentioned. You are guaranteed that the total number of tickets bought, including presales, will not exceed 1000. This is what I have so far and I cannot figure out why it wont calculate the total revenue. I am not completely sure if it is even accessing the if statement in main.

Code:

#include <stdio.h> #include <stdlib.h>
#include <string.h>
#define N 1000

[Code].....

View 4 Replies View Related

C++ :: File Read / Find - Miss 1st Line In File

May 3, 2013

I wrote the below code to find the line with "abc" as my parameter to strTosearch. I expected to the line 1st line but, this function always match the 2nd line. What am I missing here?

I wanted "found" to be "abc def hgi SSS".

Code in main()
String found=GetstringColSamLine("mytext.txt", "abc");

File name - mytext.txt
abc def hgi SSS
abc ppp yyy
string GetstringColSamLine(string routerFileName, string strTosearch)

[Code] ....

View 3 Replies View Related

Visual C++ :: Using INI File For Configuring App - System Could Not Find The File

Aug 23, 2013

I am trying to use ini file for configuring my app.

But GetPrivateProfileString is not working.

I am using Windows 7. I tried "Wow64DisableWow64FsRedirection" also.

Not only this-ATLPath::FileExists is also not working.It gives an error code 0x80070002 which means:

"system could not find the file"

View 14 Replies View Related

C :: How To Find MIN And MAX From TXT File

Mar 16, 2013

I just got assigned a project in my C programming class. The objective is to find the min and max number out of a .txt file full of numbers on separate lines called "data.txt". I am pretty much stuck at this point. I don't know how to actually scan the file and print the min and max. Also, the list of numbers in the data.txt file contains hundred on hundreds of numbers. So I couldn't specify the exact amount of numbers listed in the file. I must also find the count number, sum, and the average of the given data, So far I have:

Code:

#include<stdio.h>
int main()
{
int counter=0;
int maximum=0, minimum=1;
int num_data_points, avg;
double max, min;
FILE *sensor;
sensor = fopen("data.txt", "r");

[Code]...

View 6 Replies View Related

C++ :: Cannot Find File Specified

Jun 9, 2014

when I try to run the program (new to VC++, I click the green arrow next to "Debug" in the toolbar, right) and I get a message box - code builds without errors - but the debugger says: "Unable to start program 'c:users/sal/documents/visual studio 2010/Projects/SFML App/Debug/SFML App.exe Cannot find file specified"...well, I go to the directory it says, and nothing is even in the Debug file.

View 10 Replies View Related

C++ :: System Cannot Find The File Specified

Apr 4, 2013

I just purchased Visual C++ 2010 Ultimate, to start my coding experience. Whenever I try to debug, it gives me this error:

The system cannot find the file specified

It can't find the .exe file, I even Googled it, and tried a few things, without any luck.

View 2 Replies View Related

C++ :: Cannot Find Or Open Pdb File

Jan 24, 2013

I'm trying to write a program for a pong game using a tutorial online. Every time i try to run my program its telling me "Cannot find or open pdb file" I have tried running Microsoft visual c++ as administrator and checking the box next to the Microsoft symbol server. I only get a black console screen with a blinking cursor.

View 2 Replies View Related

C# :: Could Not Find File PictureBox

Mar 24, 2015

I am working with windows mobile 6.5 and sql compact, trying to create application to save pic on database but when i try to save pic that loaded to picturebox it giving this error "could not find file 'picturebox" and in windows mobile we don't have imagelocation property and this is code that i use it

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

[code]....

View 3 Replies View Related

C/C++ :: System Cannot Find The File Specified

Jun 29, 2014

I can't debug anything and get an error whenever I try. Being able to release a program to run it works sometimes, but it's hit or miss. I've created a very simple program to show the problem. The error on the screen is a result of me trying to debug, but I actually received the same error when trying to release as well.

View 6 Replies View Related

C++ :: Unable To Find Or Open The PDB File

Mar 28, 2014

Code:

'test.exe': Loaded 'C:UsersPcDocumentsVisual Studio 2010Projects estDebug est.exe', Symbols loaded.
'test.exe': Loaded 'C:WindowsSysWOW64
tdll.dll', Symbols loaded (source information stripped).
'test.exe': Loaded 'C:WindowsSysWOW64kernel32.dll', Symbols loaded (source information stripped).

[Code]...

The thread 'Win32 Thread' (0x2d0) has exited with code 1 (0x1).

The program '[6040] test.exe: Native' has exited with code 1 (0x1). my code is not wrong but there is an error which ı dont understand ...where is my error?

View 1 Replies View Related

C :: How To Scan In Numbers From File And Find The Largest

Oct 4, 2013

I'm working on a silent auction program that will scan a file and find the highest from each group of bids, then have a running total of money made throughout the auction. I'm pretty sure the rest of my code works, i'm just getting stuck on finding the largest number from the line in the file, saving it, then moving to the next auction.

input file text (first number is num of auctions, after that it's num of bids, then the bids):

5 4 100 500 250 300 1 700 3 300 150 175 2 920 680 8 20 10 15 25 50 30 19 23

Sample Output
Auction 1 sold for $500.00!
Auction 2 sold for $700.00!
Auction 3 sold for $300.00!
Auction 4 sold for $920.00!
Auction 5 sold for $50.00!

The silent auction raised $2470.00 for charity!

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

[Code].....

View 4 Replies View Related

C :: Find The Maximum Value In A Column Of Text File

Jul 28, 2014

I have problem with finding the maximum value in a column. This is my code

Code:
#include <stdio.h>
#include <stdlib.h>
int main() {
FILE *fp;
fp = fopen ("C:
ocket1.txt", "r");
float time, altitude, velocity, acceleration, amax, bmax;

[Code] ....

The first loop will print out all of numbers in the velocity column. The second while loop is looking for the maximum value in that column. It is supposed to print out the max velocity in the end of the second loop. However, when I build and run the program, it's crashed. I run debugger and received "Segmentation fault" error. When I eliminate the second loop, it run just fine I use Code::Block for text editor.

View 8 Replies View Related

C++ :: Find / Calculate And Replace A String In A File

Feb 3, 2013

i have a text file... with example following content:

Pizza 23232
Car 44,495
Drink 3493,90494
....
..
.

and so on..

no i want to find the 44,495 in this textfile.. calculate a new value like 44,495 x 2 + 5

and write the same file as

Pizza 23232
Car 93,99
Drink 3493,90494
....
..
.

back..

View 2 Replies View Related

C++ :: How To Find And Replace Info In Text File

Jul 1, 2014

I have a program that gives the user the option to create an employee ID, name, address and so on. It also has the option to search employee by employee ID.

What I want to know is how to add and replace employee info. For example employee changes address. Also how to delete employee information from text file.

Here's my code:

//This program uses file input and output for an employee information system.
#include <iostream>
#include <string>
#include <fstream>
using namespace std;
int main(){
ifstream inFile; //declare ifstream as inFile and ofstream as outFile
ofstream outFile;

[Code] ....

View 1 Replies View Related

C/C++ :: Find Number Of Characters In TXT File Without Spaces

Feb 17, 2015

How does one read the number of characters in a .txt file excluding the spaces? Here is my code so far. I am getting 67, which is the correct number including spaces but can't find out how to exclude them. Here's my code!

#include <iostream>
#include <string>
#include <fstream>
using namespace std;
/////////------------------/////////
//Function Prototypes//
int fileLength();

[Code] .....

View 6 Replies View Related

C++ :: Function To Find Sum Of Certain Word In Text File?

Jul 26, 2014

I've written a function that has to receive a word as parameter, and then has to find the amount of times that word (uppercase & lowercase) occurs in a text file:

For example, if the word "the" is sent as a parameter, the total amount of times the words "the" and "THE" occurs in the text file, has to be calculated.

However, my function is not displaying the correct amount, what is wrong with my function:

int WordCount :: countWords(string wrd)
{
int counter=0;
string temp = "";

[Code].....

View 1 Replies View Related

C/C++ :: Program Cannot Find Words In The File If They Are On Another Line

Apr 3, 2015

I wrote this code to search words in the file and display if the program found the word or not. when i write the words in the file on the same line (without the endl) like this :

w_toFile << "gilbert";
w_toFile << "lara";
w_toFile << "rana";
i can search any word.

but when i write them with the endl, the program can find only the first word. what can i do to make the program find any word even if they are each on a line?

here is the full code:

#include <iostream>
#include <windows.h>
#include <fstream>
#include <string>
using namespace std;
int main (void) {
string wordsearch;

[Code] ....

View 5 Replies View Related







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