Laser pointer discussion. Read/write reviews of laser pointers and laser pointer companies. Learn about all types of laser pointers and lasers





Welcome to Laser Pointer Forums! If you are looking for a laser pointer or want to compare different laser pointer companies, you may want to check out the LPF Laser Pointer Company Database. The link will open in a new window for your convenience.








Green Laser Pointers by Category Blue Laser Pointers by Category Red Laser Pointers by Category
Yellow Laser Pointers by Category Violet Laser Pointers by Category Orange Laser Pointers by Category
Top Laser Pointers by Power - 1 Watt+ Top Laser Pointers by Power - 500mW+ Top Laser Pointers by Power - 250mW+
Laser Pointer Database High Power Laser Pointers Laser Pointer Diodes
Laser Technology Laser Pointer Parts Lasers by Wavelength
Top 10 Laser Pointer Companies Laser Pointer Company Database Visible Beam Laser Pointers


One laser store meets all your needs

























Go Back   Laser Pointer Forums - Discuss Laser Pointers > Lasers > Tutorials, Help & Repairs



LPF List of Laser Pointer Companies (link opens new window)



Reply
 
LinkBack Thread Tools Display Modes
Old 06-15-2008, 09:41 PM #1
Cereal Eater
 
Join Date: Dec 2007
Location: Argentina
Posts: 6,333
Rep Power: 331
nikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond repute
Send a message via MSN to nikokapo
nikokapo nikokapo is offline
Cereal Eater
 
Join Date: Dec 2007
Location: Argentina
Posts: 6,333
Rep Power: 331
nikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond repute
Send a message via MSN to nikokapo
Default Coding Easy Program HELP

ok,
i've been trying to write something in C

but i just cant do it

i need to write a program in C which reads the names of every file (folder or/and files) inside a folder and just save the names (not directory, dont need the extension, just the NAME) into a .txt



i.e.

if i have a folder named NIKO

and inside that folder i have:


folder HELLO
folder HI
mp3 file HELLO - YOUR SONG


the txt should have

HELLO
HI
HELLO - YOUR SONG

inside it




could you please help me to do this? i know it's simple but i forgot how to use strings and reading files in c


nikokapo is offline   Reply With Quote







LPF List of Laser Pointer Companies (link opens new window)







Old 06-16-2008, 01:44 AM #2
SenKat_Stonetek's Avatar
Class 4 Laser
 
Join Date: Mar 2008
Location: San Antonio, TEXAS !!!
Posts: 6,058
Rep Power: 41
SenKat_Stonetek is a splendid one to beholdSenKat_Stonetek is a splendid one to beholdSenKat_Stonetek is a splendid one to beholdSenKat_Stonetek is a splendid one to beholdSenKat_Stonetek is a splendid one to beholdSenKat_Stonetek is a splendid one to beholdSenKat_Stonetek is a splendid one to behold
SenKat_Stonetek SenKat_Stonetek is offline
Class 4 Laser
SenKat_Stonetek's Avatar
 
Join Date: Mar 2008
Location: San Antonio, TEXAS !!!
Posts: 6,058
Rep Power: 41
SenKat_Stonetek is a splendid one to beholdSenKat_Stonetek is a splendid one to beholdSenKat_Stonetek is a splendid one to beholdSenKat_Stonetek is a splendid one to beholdSenKat_Stonetek is a splendid one to beholdSenKat_Stonetek is a splendid one to beholdSenKat_Stonetek is a splendid one to behold
Default Re: Coding Easy Program HELP

Why not use the TREE command ? Drop to a command prompt and check that out
SenKat_Stonetek is offline   Reply With Quote
Old 06-16-2008, 02:05 AM #3
Bionic-Badger's Avatar
Class 4 Laser
 
Join Date: Oct 2007
Location: Oregon, USA
Posts: 5,478
Rep Power: 3157
Bionic-Badger has a reputation beyond reputeBionic-Badger has a reputation beyond reputeBionic-Badger has a reputation beyond reputeBionic-Badger has a reputation beyond reputeBionic-Badger has a reputation beyond reputeBionic-Badger has a reputation beyond reputeBionic-Badger has a reputation beyond reputeBionic-Badger has a reputation beyond reputeBionic-Badger has a reputation beyond reputeBionic-Badger has a reputation beyond reputeBionic-Badger has a reputation beyond repute
Bionic-Badger Bionic-Badger is offline
Class 4 Laser
Bionic-Badger's Avatar
 
Join Date: Oct 2007
Location: Oregon, USA
Posts: 5,478
Rep Power: 3157
Bionic-Badger has a reputation beyond reputeBionic-Badger has a reputation beyond reputeBionic-Badger has a reputation beyond reputeBionic-Badger has a reputation beyond reputeBionic-Badger has a reputation beyond reputeBionic-Badger has a reputation beyond reputeBionic-Badger has a reputation beyond reputeBionic-Badger has a reputation beyond reputeBionic-Badger has a reputation beyond reputeBionic-Badger has a reputation beyond reputeBionic-Badger has a reputation beyond repute
Default Re: Coding Easy Program HELP

If you can tolerate the extensions you can type:

Code:
dir /b > out.txt
However, if you're still hell-bent on using a C++ program, I made this:

Code:
#include <iostream>

#define LINE_LENGTH * * * * * * 300

using namespace std;

int main ()
{
 * *char line[LINE_LENGTH];
 * *while (cin)
 * *{
 * * * *cin.getline (line, LINE_LENGTH);
 * * * *// Read position of last period to find the location of the
 * * * *// extension:
 * * * *char *dot = strrchr(line, '.');
 * * * *if (dot)
 * * * *{
 * * * * * **dot = 0; // NULL-terminate here to strip extension.
 * * * *}
 * * * *cout << line << endl;
 * *}
 * *return 0;
}
Usage (say the executable is called "strip_ext.exe&quot:

Code:
dir /b | strip_ext.exe > out.txt
__________________
You must spread some Reputation around before giving it to <person> again.
Bionic-Badger is offline   Reply With Quote
Old 06-16-2008, 03:30 AM #4
Cereal Eater
 
Join Date: Dec 2007
Location: Argentina
Posts: 6,333
Rep Power: 331
nikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond repute
Send a message via MSN to nikokapo
nikokapo nikokapo is offline
Cereal Eater
 
Join Date: Dec 2007
Location: Argentina
Posts: 6,333
Rep Power: 331
nikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond repute
Send a message via MSN to nikokapo
Default Re: Coding Easy Program HELP

I appreciate your help, Bionic, but I can read C, not C++


i'll try the first one
nikokapo is offline   Reply With Quote
Old 06-16-2008, 03:39 AM #5
Cereal Eater
 
Join Date: Dec 2007
Location: Argentina
Posts: 6,333
Rep Power: 331
nikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond repute
Send a message via MSN to nikokapo
nikokapo nikokapo is offline
Cereal Eater
 
Join Date: Dec 2007
Location: Argentina
Posts: 6,333
Rep Power: 331
nikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond repute
Send a message via MSN to nikokapo
Default Re: Coding Easy Program HELP

Tried the 1st. one, but i dont know where the out.txt file is saved :S


EDIT: found where it is saved!

EDIT 2: damn, it doesn't go in order, and it adds a lot of stuff BEFORE the filename (the size, date &amp; more)

isnt there a simple way to do it in C with just a string and a while (something)?
nikokapo is offline   Reply With Quote
Old 06-16-2008, 05:05 AM #6
Junior Member
 
Join Date: May 2008
Posts: 22
Rep Power: 0
NovoRei is on a distinguished road
NovoRei NovoRei is offline
Junior Member
 
Join Date: May 2008
Posts: 22
Rep Power: 0
NovoRei is on a distinguished road
Default Re: Coding Easy Program HELP

This is a work for RECURSSION!!!! o/ (dont use this on low memory system)

Maybe, you could use fread, but i dont know where and how the file name is structured.

For sure exist some library for this.


Or you could just erase what is not the name lol. Its like shooting with a bazuka against a fly.
NovoRei is offline   Reply With Quote
Old 06-16-2008, 05:43 AM #7
Cereal Eater
 
Join Date: Dec 2007
Location: Argentina
Posts: 6,333
Rep Power: 331
nikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond repute
Send a message via MSN to nikokapo
nikokapo nikokapo is offline
Cereal Eater
 
Join Date: Dec 2007
Location: Argentina
Posts: 6,333
Rep Power: 331
nikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond repute
Send a message via MSN to nikokapo
Default Re: Coding Easy Program HELP

Quote:
Originally Posted by NovoRei
This is a work for RECURSSION!!!! o/ (dont use this on low memory system)

Maybe, you could use fread, but i dont know where and how the file name is structured.

For sure exist some library for this.


Or you could just erase what is not the name lol. Its like shooting with a bazuka against a fly.

WHAT?
nikokapo is offline   Reply With Quote
Old 06-16-2008, 06:48 PM #8
Bionic-Badger's Avatar
Class 4 Laser
 
Join Date: Oct 2007
Location: Oregon, USA
Posts: 5,478
Rep Power: 3157
Bionic-Badger has a reputation beyond reputeBionic-Badger has a reputation beyond reputeBionic-Badger has a reputation beyond reputeBionic-Badger has a reputation beyond reputeBionic-Badger has a reputation beyond reputeBionic-Badger has a reputation beyond reputeBionic-Badger has a reputation beyond reputeBionic-Badger has a reputation beyond reputeBionic-Badger has a reputation beyond reputeBionic-Badger has a reputation beyond reputeBionic-Badger has a reputation beyond repute
Bionic-Badger Bionic-Badger is offline
Class 4 Laser
Bionic-Badger's Avatar
 
Join Date: Oct 2007
Location: Oregon, USA
Posts: 5,478
Rep Power: 3157
Bionic-Badger has a reputation beyond reputeBionic-Badger has a reputation beyond reputeBionic-Badger has a reputation beyond reputeBionic-Badger has a reputation beyond reputeBionic-Badger has a reputation beyond reputeBionic-Badger has a reputation beyond reputeBionic-Badger has a reputation beyond reputeBionic-Badger has a reputation beyond reputeBionic-Badger has a reputation beyond reputeBionic-Badger has a reputation beyond reputeBionic-Badger has a reputation beyond repute
Default Re: Coding Easy Program HELP

C++ is superior to C and that simple program shouldn't be hard for anyone to figure out. It also doesn't seem like you're trying to learn how to use this if you're just going to use the first example, so why not just use it? It's actually only used for stripping the extension from the filename, while the actual directory traversal and listing is done by the &quot;dir&quot; command.

Novorei: Unless you're using an archaic 386 with 2MB of RAM or something, it's not going to matter. Besides, this can be done without the need for recursion.
__________________
You must spread some Reputation around before giving it to <person> again.
Bionic-Badger is offline   Reply With Quote
Old 06-16-2008, 07:05 PM #9
Cereal Eater
 
Join Date: Dec 2007
Location: Argentina
Posts: 6,333
Rep Power: 331
nikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond repute
Send a message via MSN to nikokapo
nikokapo nikokapo is offline
Cereal Eater
 
Join Date: Dec 2007
Location: Argentina
Posts: 6,333
Rep Power: 331
nikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond repute
Send a message via MSN to nikokapo
Default Re: Coding Easy Program HELP

Quote:
Originally Posted by Bionic-Badger
C++ is superior to C and that simple program shouldn't be hard for anyone to figure out. *It also doesn't seem like you're trying to learn how to use this if you're just going to use the first example, so why not just use it? *It's actually only used for stripping the extension from the filename, while the actual directory traversal and listing is done by the &quot;dir&quot; command.

Novorei: *Unless you're using an archaic 386 with 2MB of RAM or something, it's not going to matter. *Besides, this can be done without the need for recursion.
Sorry if you think i meant it like that.

I need the solution, but i'd also like to learn how to code it if i ever need anything else

the thing is that i studied 1 year of C.
i cant just start guessing how to do stuff in C++

the first example actually takes me more time to revise and delete the stuff i need than copying every filename manually

i'll try to code it in C.



thanks for the help
nikokapo is offline   Reply With Quote
Old 06-21-2008, 04:45 AM #10
Cereal Eater
 
Join Date: Dec 2007
Location: Argentina
Posts: 6,333
Rep Power: 331
nikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond repute
Send a message via MSN to nikokapo
nikokapo nikokapo is offline
Cereal Eater
 
Join Date: Dec 2007
Location: Argentina
Posts: 6,333
Rep Power: 331
nikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond reputenikokapo has a reputation beyond repute
Send a message via MSN to nikokapo
Default Re: Coding Easy Program HELP

Ok

got it

this gives me the output in a .txt temp file of the directory in which the .bat is placed:

Code:
dir /a /b /-p /o:gen &gt;C:\WINDOWS\Temp\file_list_full.txt
start notepad C:\WINDOWS\Temp\file_list_full.txt

Thanks everyone!
nikokapo is offline   Reply With Quote
Reply





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











Loading








Green Laser Pointers by Category Blue Laser Pointers by Category Red Laser Pointers by Category
Yellow Laser Pointers by Category Violet Laser Pointers by Category Orange Laser Pointers by Category
Top Laser Pointers by Power - 1 Watt+ Top Laser Pointers by Power - 500mW+ Top Laser Pointers by Power - 250mW+
Laser Pointer Database High Power Laser Pointers Laser Pointer Diodes






Privacy Policy | Advertising Disclaimer | Terms of Use


 


All times are GMT. The time now is 12:10 PM.


Powered by: vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO
Privacy Policy | Advertising Disclaimer | Terms of Use
Copyright (C) 2017 Laser Pointer Forums, LLC