Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 04-30-2005, 12:22 PM   #1 (permalink)
Caleb.Carlton
Registered User
 
Join Date: Oct 2004
Posts: 7
Caleb.Carlton is on a distinguished road
Go to a specific line. C++

Is there any way to go to a specific line of a text file and print it to screen. There was a thread where this was awnsered, but that was in C. I need to know how to do this in C++. Thanks.
Caleb.Carlton is offline   Reply With Quote
Old 05-01-2005, 07:10 PM   #2 (permalink)
Valmont
[code][/code] enforcer
 
Valmont's Avatar
 
Join Date: Mar 2003
Location: Netherlands
Posts: 1,544
Valmont is on a distinguished road
Only when you open the file in binary mode, more or less.
Or you could just use std::getline a few times until you arrived at the destination. One way or the other, it will be quite some code. You'll need to be very specific in what you want to achieve, or post the code. Otherwise there will be no end in coding.
__________________
Valmont is offline   Reply With Quote
Old 05-02-2005, 05:27 PM   #3 (permalink)
Caleb.Carlton
Registered User
 
Join Date: Oct 2004
Posts: 7
Caleb.Carlton is on a distinguished road
I need to go to a randomly selected line of a text file. For instance, I have a text file with 40 lines of text. I need the program to go to one random line of the text file and print the contents of that line to screen.
Caleb.Carlton is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Class using a specific instance of another class? is this possible? abs Standard C, C++ 5 02-08-2005 04:12 PM
cgi script Henry PHP 25 12-30-2002 07:54 AM
edit? anon Lounge 10 11-21-2002 04:02 PM


All times are GMT -8. The time now is 05:27 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting