Click here to Skip to main content
15,918,967 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: About ownerdraw Pin
Hamid_RT25-Jun-07 19:57
Hamid_RT25-Jun-07 19:57 
GeneralRe: About ownerdraw Pin
whiteclouds22-Jun-07 2:47
whiteclouds22-Jun-07 2:47 
GeneralRe: About ownerdraw Pin
Hamid_RT22-Jun-07 4:45
Hamid_RT22-Jun-07 4:45 
JokeRe: About ownerdraw Pin
whiteclouds22-Jun-07 16:49
whiteclouds22-Jun-07 16:49 
QuestionString to integer array algorithm Pin
Llasus20-Jun-07 16:09
Llasus20-Jun-07 16:09 
AnswerRe: String to integer array algorithm Pin
_anil_20-Jun-07 18:51
_anil_20-Jun-07 18:51 
GeneralRe: String to integer array algorithm Pin
Llasus20-Jun-07 19:09
Llasus20-Jun-07 19:09 
AnswerRe: String to integer array algorithm Pin
Stephen Hewitt20-Jun-07 20:42
Stephen Hewitt20-Jun-07 20:42 
Is each line meant to be a separate array or are all the numbers meant to be in 1 array? Anyhow, here’s how I’d do it assuming one big array (with little error checking):
// Console.cpp : Defines the entry point for the console application.
//
 
#include "stdafx.h"
#include <vector>
#include <fstream>
#include <iostream>
#include <algorithm>
#include <iterator>
 
int main(int arvc, char* argv[])
{
	using namespace std;
 
	// Attempt to open the file.
	ifstream ifs("C:\\Data.txt");
	if (!ifs)
	{
		cerr << "Failed to open input file." << endl;
		return 1;
	}
 
	vector<int> numbers; // Use a vector instead or raw arrays.
 
	// Read the data into the vector.
	typedef istream_iterator<int> isit;
	copy(isit(ifs), isit(), back_inserter(numbers));
 
	// Output the results to the console.
	copy(numbers.begin(), numbers.end(), ostream_iterator<int>(cout, "\n"));
 
	return 0;
}

As for your speed concerns, I would suggest you make the code simple first and only worry about speed if it’s a real rather than an imagined issue.


Steve

GeneralRe: String to integer array algorithm Pin
_anil_20-Jun-07 20:46
_anil_20-Jun-07 20:46 
GeneralRe: String to integer array algorithm Pin
Llasus21-Jun-07 13:39
Llasus21-Jun-07 13:39 
GeneralMFC Bitmap Help [modified] Pin
dipen.rana20-Jun-07 11:33
dipen.rana20-Jun-07 11:33 
GeneralRe: MFC Bitmap Help Pin
Christian Graus20-Jun-07 11:46
protectorChristian Graus20-Jun-07 11:46 
GeneralRe: MFC Bitmap Help Pin
Mark Salsbery20-Jun-07 12:04
Mark Salsbery20-Jun-07 12:04 
GeneralRe: MFC Bitmap Help Pin
Hamid_RT20-Jun-07 18:42
Hamid_RT20-Jun-07 18:42 
GeneralRe: MFC Bitmap Help Pin
Mark Salsbery21-Jun-07 5:19
Mark Salsbery21-Jun-07 5:19 
GeneralRe: MFC Bitmap Help Pin
Hamid_RT21-Jun-07 19:43
Hamid_RT21-Jun-07 19:43 
GeneralRe: MFC Bitmap Help Pin
dipen.rana25-Jun-07 5:43
dipen.rana25-Jun-07 5:43 
GeneralRe: MFC Bitmap Help Pin
Mark Salsbery25-Jun-07 7:40
Mark Salsbery25-Jun-07 7:40 
GeneralRe: MFC Bitmap Help Pin
dipen.rana25-Jun-07 8:45
dipen.rana25-Jun-07 8:45 
GeneralRe: MFC Bitmap Help Pin
Mark Salsbery25-Jun-07 13:49
Mark Salsbery25-Jun-07 13:49 
GeneralRe: MFC Bitmap Help Pin
dipen.rana2-Jul-07 10:00
dipen.rana2-Jul-07 10:00 
QuestionOptimizing floating-point calculation performance with 64-bit applications? Pin
Cyrilix20-Jun-07 11:16
Cyrilix20-Jun-07 11:16 
QuestionCInternetSession question Pin
baloneyman20-Jun-07 9:51
baloneyman20-Jun-07 9:51 
QuestionAnyone know which file defines GET_X_LPARAM and GET_Y_LPARAM macros for WM_MOUSEMOVE? Pin
Cyrilix20-Jun-07 9:12
Cyrilix20-Jun-07 9:12 
AnswerRe: Anyone know which file defines GET_X_LPARAM and GET_Y_LPARAM macros for WM_MOUSEMOVE? Pin
Mark Salsbery20-Jun-07 9:30
Mark Salsbery20-Jun-07 9:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.