ok, NEED HELP HERE TO GET ALL THE CHARACTERS IN THE TEXT FILE AS A FULL LENGTH AND DO SOMETHING WITH IT... Line 31

#include "stdafx.h"
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <fstream>

#ifndef _DEPRECATION_DISABLE   /* One time only */
#define _DEPRECATION_DISABLE   /* Disable deprecation true */
#if (_MSC_VER >= 1400)         /* Check version */
#pragma warning(disable: 4996) /* Disable deprecation */
#endif /* #if defined(NMEA_WIN) && (_MSC_VER >= 1400) */
#endif

#define TEXTMAX 99999//maximum text length
#define WORDMAX 20//maximum word length
using namespace std;

void main()
{

nd *list = NULL, *tempPointer = NULL;
char text[TEXTMAX], word[WORDMAX];
int textLength=0, i, tempIndex = 0, count=0;

std::ifstream in("textfile.txt");

//NEED HELP HERE TO GET ALL THE CHARACTERS IN THE TEXT FILE AS A FULL LENGTH AND DO SOMETHING WITH IT...

gets(text); 
textLength = strlen(text);//get the length of the text
//..
//..
//..DO WATEVER...

Recommended Answers

All 3 Replies

What is your code doing or not doing that you want changed?
What is a sample of the data in the text file?

I need to read a text file, i.e. "hello world, how are you doin" line 31.

i need to output it to the console as characters of "text" so i can grab it.

gets(text);
textLength = strlen(text);

cout << text; will put the text to the console.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.