Hello Guest, please login or register.
Did you miss your activation email?
Login with username, password and session length.

Pages: [1]   Go Down

Author Topic: C++ Workin with files  (Read 821 times)

0 Members and 1 Guest are viewing this topic.

PoeFacedKilla

Prussian Killer Bee
C++ Workin with files
« on: May 29, 2007, 03:28:26 am »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 269
Is it possible to load code from a .txt file? like if i put cout<<"This is From a File";
it would show that in the program?
« Last Edit: June 02, 2007, 05:37:09 pm by 4Sword »
Logged
the Indyboard - User Generated Social Forum | Now With Even More Discussion!
Poe, The Independent Programmer
  • Zelda Shrine
Re: C++ Workin with files
« Reply #1 on: May 29, 2007, 06:31:22 am »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 2245
No. At least not without having to create your own parser.
Logged
Re: C++ Workin with files
« Reply #2 on: May 29, 2007, 10:55:14 am »
  • *
  • Reputation: +3/-0
  • Offline Offline
  • Gender: Male
  • Posts: 6629
No, thats a features reserved only for scripting languages. With pre-compiled code its next to impossible.
Logged
Re: C++ Workin with files
« Reply #3 on: May 29, 2007, 07:26:31 pm »
  • IBV
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Female
  • Posts: 1075
You could compile the external source code (in the .txt file for this example) on run time and then load it dynamically. Although that means the user of your program needs to have a compiler installed. And now we are talking about really advanced stuff.

Or, if your .txt-files would only need a limited sets of functions and not too much code (we are not talking about real-time code here, do we?) you can easily make some kind of simple naive parser (e.g. line-by-line each argument separated by space, first argument function-name) for it without that much knowledge on how to write an optimized one.
Logged
My signature is empty.
Pages: [1]   Go Up

 


Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved



Page created in 0.426 seconds with 45 queries.

anything