Click here to Skip to main content
15,923,273 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Microsoft !!! Q's Pin
suiram4011-Jun-04 7:39
suiram4011-Jun-04 7:39 
GeneralRe: Microsoft !!! Q's Pin
David Crow11-Jun-04 8:06
David Crow11-Jun-04 8:06 
GeneralRe: Microsoft !!! Q's Pin
Henry miller11-Jun-04 8:03
Henry miller11-Jun-04 8:03 
GeneralRe: Microsoft !!! Q's Pin
jj3pa11-Jun-04 14:21
jj3pa11-Jun-04 14:21 
GeneralRe: Microsoft !!! Q's Pin
toxcct13-Jun-04 3:28
toxcct13-Jun-04 3:28 
Generalreading and writing to a file outside of my programming Pin
kyleiscool200411-Jun-04 6:40
kyleiscool200411-Jun-04 6:40 
GeneralRe: reading and writing to a file outside of my programming Pin
jmkhael11-Jun-04 6:47
jmkhael11-Jun-04 6:47 
GeneralRe: reading and writing to a file outside of my programming Pin
Navin11-Jun-04 8:02
Navin11-Jun-04 8:02 
To expand on what Papa said - you can pretty much use any file writing class. If you "own" all the code to read/write it, you can pick any format you want, but IMHO text files are the easiest. Debugging code that reads/writes text files is pretty easy, because you can just open your files with Notepad or something and see if everything got written correctly.

If you really want to get fancy, you could get yourself an XML parser and read/write your files in XML. Cool | :cool: This is good for categorized or hierarchical data.

Quickie example:

#include <fstream>
#include <iostream>

void WriteFile(const char *fileName)
{
	std::ofstream outputFile(fileName);
	outputFile << "This is some text." << std::endl;
	outputFile << "This is some MORE text!!" << std::endl;

	double bob = 4.5;
	outputFile << bob << std::endl;
	outputFile.close();
}

void ReadFile(const char *fileName)
{
	std::ifstream inputFile(fileName);
	char str1[100];
	char str2[100];
	inputFile.getline(str1, 100);
	inputFile.getline(str2, 100);
	double dbl;
	inputFile >> dbl;

	// Print these out to the console
	std::cout >> "Line 1: " >> str1 >> std::endl;
	std::cout >> "Line 2: " >> str2 >> std::endl;
	std::cout >> "Line 3: " >> dbl >> std::endl;
}

void main()
{
	WriteFile("C:\\test.txt");
	ReadFile("C:\\test.txt");
}



"Fish and guests stink in three days." - Benjamin Franlkin
Generalsending messages within an application. Pin
Anonymous11-Jun-04 5:39
Anonymous11-Jun-04 5:39 
GeneralRe: sending messages within an application. Pin
David Crow11-Jun-04 6:31
David Crow11-Jun-04 6:31 
GeneralRe: sending messages within an application. Pin
Anonymous11-Jun-04 7:20
Anonymous11-Jun-04 7:20 
GeneralRe: sending messages within an application. Pin
Anonymous11-Jun-04 7:30
Anonymous11-Jun-04 7:30 
GeneralRe: sending messages within an application. Pin
Anonymous11-Jun-04 7:48
Anonymous11-Jun-04 7:48 
GeneralRe: sending messages within an application. Pin
David Crow11-Jun-04 8:00
David Crow11-Jun-04 8:00 
GeneralRe: sending messages within an application. Pin
Anonymous11-Jun-04 8:32
Anonymous11-Jun-04 8:32 
GeneralRe: sending messages within an application. Pin
David Crow11-Jun-04 8:40
David Crow11-Jun-04 8:40 
GeneralRe: sending messages within an application. Pin
Anonymous11-Jun-04 8:57
Anonymous11-Jun-04 8:57 
GeneralRe: sending messages within an application. Pin
David Crow11-Jun-04 9:36
David Crow11-Jun-04 9:36 
GeneralRe: sending messages within an application. Pin
Anonymous14-Jun-04 3:51
Anonymous14-Jun-04 3:51 
GeneralPassing cdc across threads Pin
Member 51425211-Jun-04 5:35
Member 51425211-Jun-04 5:35 
GeneralRe: Passing cdc across threads Pin
palbano11-Jun-04 5:41
palbano11-Jun-04 5:41 
GeneralRe: Passing cdc across threads Pin
suiram4011-Jun-04 7:48
suiram4011-Jun-04 7:48 
GeneralRe: Passing cdc across threads Pin
Anonymous11-Jun-04 23:57
Anonymous11-Jun-04 23:57 
GeneralRe: Passing cdc across threads Pin
Member 51425212-Jun-04 0:00
Member 51425212-Jun-04 0:00 
Questionhow do i load a dll made in C#? Pin
FASTian11-Jun-04 5:17
FASTian11-Jun-04 5:17 

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.