Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

iWill

macrumors member
Original poster
Nov 24, 2006
35
0
Sry if this is too windows specific but i really need help... So I'd like to scan program files and add the names of each program in a file with each of their paths. Is it possible? This is where i"m stuck:
Code:
#include <iostream>
#include <windows.h>
#include <fstream>
using namespace std;

int main()
{
    int S1, S2;
    void list();
    void data();
    char word[25];
    
    cout << "\t\t   *****Ultimate App Launcher*****\n\n";
    cout << "[1] To Launch An App, [2] To Add an App To The List";
    cin >> S1;
     
    switch (S1)
    {
           
           case 1:
                list();
                cout << "Now Enter The Number Matching The App You Want To Launche";
                cin >> S2;
                
	
    
    
    
    
    void list()
 {
    ifstream File("Name.txt");

	char txt;
	while(!File.eof())
	{
		File.get(txt);
		cout << txt;
	}
	
    if (!File)
    {
              cout <<  cout << "Cannot Open File. You Are Missing a File of Name **Name.txt**\n\nLocate It, Then Place It Next To The Program File.\n\n";
             return 1;
    }
    
    File.close();
}
I'd like to know if i can directly read from program files, and how i could associate each app to a number so that the user only needs to type in the number to launch his application.
Thanks in advance
 

Eraserhead

macrumors G4
Nov 3, 2005
10,434
12,250
UK
What language is it? Sorry if this is a stupid question :eek:.

PS Please indent your code, it helps with reading it.
 

iWill

macrumors member
Original poster
Nov 24, 2006
35
0
Oh yea sry for not precising...it's in C++
For this program i was also thinking of dedicating one line to the program name and then the next line to it's path in the File I/O...like that each line with an even number would correspond to the program name and vice versa for the path of each program...would this be feasible?
 

iWill

macrumors member
Original poster
Nov 24, 2006
35
0
Ok....another more precise question (sorry i know i'm being kinda vague):
is it possible to compute the line numbers of a text file in C++? So that when the user enters 2, my program would read line number two of the text file?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.