Author Topic: Reading/Writing Files, Listing Directories  (Read 5681 times)

0 Members and 1 Guest are viewing this topic.

SirCmpwn

  • Guest
Reading/Writing Files, Listing Directories
« on: December 12, 2010, 10:29:50 pm »
Hello,
How do I do all of the above?

Offline jnesselr

  • King Graphmastur
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2270
  • Rating: +81/-20
  • TAO == epic
    • View Profile
Re: Reading/Writing Files, Listing Directories
« Reply #1 on: December 12, 2010, 10:31:23 pm »
In C. There are functions to read and write files (fwrite I think).

For directories, try this:
http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1046380353&id=1044780608

EDIT: http://en.wikipedia.org/wiki/C_file_input/output for reading and writing.
« Last Edit: December 12, 2010, 10:31:59 pm by graphmastur »

SirCmpwn

  • Guest
Re: Reading/Writing Files, Listing Directories
« Reply #2 on: December 12, 2010, 10:33:22 pm »
I know about the file functions, but now how to use them properly, and the docs don't help :(
The directory example uses dir.h, which is not available for download anywhere nearby.

Offline jnesselr

  • King Graphmastur
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2270
  • Rating: +81/-20
  • TAO == epic
    • View Profile
Re: Reading/Writing Files, Listing Directories
« Reply #3 on: December 12, 2010, 10:35:53 pm »
I know about the file functions, but now how to use them properly, and the docs don't help :(
The directory example uses dir.h, which is not available for download anywhere nearby.
I see.  IIRC, you open the file, and read it. Haven't done that in a while. I know you open it, read the file, and then close it. Not sure otherwise.

SirCmpwn

  • Guest
Re: Reading/Writing Files, Listing Directories
« Reply #4 on: December 12, 2010, 10:39:22 pm »
IIRC, you open the file, and read it
* SirCmpwn slaps graphmastur

Offline jnesselr

  • King Graphmastur
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2270
  • Rating: +81/-20
  • TAO == epic
    • View Profile
Re: Reading/Writing Files, Listing Directories
« Reply #5 on: December 12, 2010, 10:49:36 pm »
IIRC, you open the file, and read it
* SirCmpwn slaps graphmastur
Lol, sorry. It's platform specific, IIRC, so you are best off using a methods within #ifdef (Wait, that's C right?) based on the OS.  So, yeah, not exactly sure. I've done it before, but only when writing a stream to a log file, and that was a year ago, so I don't fully remember.

SirCmpwn

  • Guest
Re: Reading/Writing Files, Listing Directories
« Reply #6 on: December 12, 2010, 10:50:27 pm »
I might just look at the source code for mViewer, released about 12 minutes ago ;)

Offline jnesselr

  • King Graphmastur
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2270
  • Rating: +81/-20
  • TAO == epic
    • View Profile
Re: Reading/Writing Files, Listing Directories
« Reply #7 on: December 12, 2010, 10:59:47 pm »
I might just look at the source code for mViewer, released about 12 minutes ago ;)
That could work. Wait, is this for NSpire coding? Oh, I have no idea, then.

SirCmpwn

  • Guest
Re: Reading/Writing Files, Listing Directories
« Reply #8 on: December 12, 2010, 11:04:46 pm »
Lol XD

Offline apcalc

  • The Game
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1393
  • Rating: +120/-2
  • VGhlIEdhbWUh (Base 64 :))
    • View Profile
Re: Reading/Writing Files, Listing Directories
« Reply #9 on: December 12, 2010, 11:07:34 pm »
You might want to look at the source for either bwang's bmpviewer or critor's ndshell.  Both of those programs use file listing.  I have never used this, so I won't be of any help for this (although, I better learn soon, as it will probably be used in Chip's Challenge ;))


SirCmpwn

  • Guest
Re: Reading/Writing Files, Listing Directories
« Reply #10 on: December 12, 2010, 11:08:53 pm »
I would like to look at ndshell, where do I download it?  The tibank forum doesn't have a download link.

Offline apcalc

  • The Game
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1393
  • Rating: +120/-2
  • VGhlIEdhbWUh (Base 64 :))
    • View Profile


SirCmpwn

  • Guest
Re: Reading/Writing Files, Listing Directories
« Reply #12 on: December 12, 2010, 11:11:09 pm »
Thank you very much!  Looking into it now.