CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 2 of 2 FirstFirst 12
Results 16 to 29 of 29
  1. #16
    Join Date
    Oct 2002
    Location
    Arkansas, USA
    Posts
    189

    Re: Need a simple program!

    Quote Originally Posted by Xeon
    C:\Documents and Settings\Xeon > cd C:\Documents and Settings\ops-Xeon\Desktop\VidsFolder
    Xeon... Does your computer really have the TWO folder paths
    C:\Documents and Settings\Xeon
    and
    C:\Documents and Settings\ops-Xeon\Desktop\VidsFolder
    as you show from your post?

    Is it possible that you want to navigate to
    C:\Documents and Settings\Xeon\Desktop\VidsFolder
    instead?

  2. #17
    Join Date
    Jun 2007
    Location
    MA-USA
    Posts
    247

    Re: Need a simple program!

    I would say this is the prompt:
    C:\Documents and Settings\Xeon >

    And this is the response:
    cd C:\Documents and Settings\ops-Xeon\Desktop\VidsFolder

    He is changing directory via cd.

  3. #18
    Xeon's Avatar
    Xeon is offline Elite Member Power Poster
    Join Date
    Jul 2000
    Location
    Singapore
    Posts
    4,195

    Re: Need a simple program!

    No, my prompt doesn't have two folder paths, I'm just trying to cd from there, as what Bitshifter above says.

    Anyway, I'll try again tonight, and if I can't, I will start hunting around for my VC++ CD since coding the thing from scratch is easier than this......this insanity!!!!! %((&*&$!
    "Hell is calling for you!" - Rufus, from Valkyrie Profile 2 : Silmeria

    "I'm getting tired of you devils.....finishing strike......Final Blast!" - Arngrim, from Valkyrie Profile 2 : Silmeria

  4. #19
    Join Date
    Oct 2002
    Location
    Arkansas, USA
    Posts
    189

    Re: Need a simple program!

    Xeon,
    At the command prompt, type cd .. (to back up 1 level), then type dir - Like this:
    Code:
    C:\Documents and Settings\Xeon >cd ..
    Code:
    C:\Documents and Settings\ >dir
    Post the list of directories that show up when you have done that.

  5. #20
    Join Date
    Nov 2002
    Location
    Los Angeles, California
    Posts
    3,863

    Re: Need a simple program!

    Heh Xeon, good to hear from you again. Pretty funny that you are having trouble with the command line, but then the windows command line leaves a lot to be desired.
    Last edited by souldog; August 27th, 2008 at 01:22 AM.
    Wakeup in the morning and kick the day in the teeth!! Or something like that.

    "i don't want to write leak free code or most efficient code, like others traditional (so called expert) coders do."

  6. #21
    Join Date
    Jul 2008
    Location
    Cochin, Kerala
    Posts
    145

    Cool Re: Need a simple program!

    Code:
    void iterateFolder()
    	{
    		 WIN32_FIND_DATA fileInfo; 
    		 lstrcat(rootPath,_T("\\*.*")); // where rootPath is the path to folder, use SHBrowseForFolder() to get path to folder.
    		 HANDLE fileHandle = FindFirstFile(rootPath,(LPWIN32_FIND_DATA)&fileInfo);
    
    		 if(fileHandle !=  INVALID_HANDLE_VALUE)
    		 {
    			while(FindNextFile(fileHandle,(LPWIN32_FIND_DATA)&fileInfo))
    			{
    				//here you will get the filenames in fileInfo.cFileName
    			}
    		 }
    		 FindClose(fileHandle);
    	}
    cheers

  7. #22
    Join Date
    Jun 2007
    Location
    MA-USA
    Posts
    247

    Re: Need a simple program!

    Code:
    C:\Documents and Settings\Xeon > help

  8. #23
    Join Date
    Apr 1999
    Posts
    27,449

    Re: Need a simple program!

    Quote Originally Posted by Xeon
    And yeah, it's not surprising for noob programmers not to know how to use these command-line stuff if all they ever did was MFC visual stuff all done in Windows 98 / XP interface.
    So when you create a simple program like this, how do you run it on a friends machine that doesn't have Visual C++ installed?
    Code:
    #include <iostream>
    
    int main()
    {
       std::cout << "Hello World";
    }
    Won't it seem strange that you can't run a simple "Hello World" program, but at the same time claim to be a Windows programmer?

    The command-line has been an integral part of Windows. IMO, any programmer whos realm is Windows programming is seriously deficient (and I mean seriously) in the knowledge of the OS if they do not know how to use the command-line, even for simple commands.

    Regards,

    Paul McKenzie

  9. #24
    Xeon's Avatar
    Xeon is offline Elite Member Power Poster
    Join Date
    Jul 2000
    Location
    Singapore
    Posts
    4,195

    Wink Re: Need a simple program!

    To gjs368: Finally, the "cd .." is the trick that solves all the problems! With this trick, I can navigate to any directory I want! Cheers!

    To SoulDog: It's been years! I still remember you, your ID and your avatar! Seems that for a lot of people here, once they've set an avatar, it's for life!

    From Paul:
    So when you create a simple program like this, how do you run it on a friends machine that doesn't have Visual C++ installed?
    Why does he need VC++? If I still had my VC++ compiler, I just need to paste the folder-looping code and compile the program into an EXE file and send the file to him, and he'll place the file in his folder and execute the program and it'll do the rest.

    Won't it seem strange that you can't run a simple "Hello World" program, but at the same time claim to be a Windows programmer?
    Actually, for the command line, I only know how to open the window (Start menu > Run > command).
    And the only commands I know of are: cd and dir.
    I dunno anything else.

    And from the VC++ studio, all I need is to click the Execute button to run my Win32 DOS programs, I don't even need anything. That software shielded me from everything.

    The command-line has been an integral part of Windows. IMO, any programmer whos realm is Windows programming is seriously deficient (and I mean seriously) in the knowledge of the OS if they do not know how to use the command-line, even for simple commands.
    As long as the Windows programmer isn't creating any low-level software, he doesn't even need to know how to use the command line.

    If you see those "Teach yourself VC++ ... in 21 days" or Jeff Prosise's MFC programming kind of books, they don't even mention the command line.
    All they ever talk about are C++ code, VC++ software usage and MFC.

    IMO, it's possible for a Windows programmer to write functional Windows programmers without even knowing there's such a thing called "command line".

    Now, pls zip your mouth, go to bed and be a good little boy.
    You should laugh more and be more tolerant of noobs.
    "Hell is calling for you!" - Rufus, from Valkyrie Profile 2 : Silmeria

    "I'm getting tired of you devils.....finishing strike......Final Blast!" - Arngrim, from Valkyrie Profile 2 : Silmeria

  10. #25
    Join Date
    Apr 1999
    Posts
    27,449

    Re: Need a simple program!

    Quote Originally Posted by Xeon
    As long as the Windows programmer isn't creating any low-level software, he doesn't even need to know how to use the command line.
    There is a lot of software that is not low-level, but is started via command-line. For example, we have a utility that automatically scans images via TWAIN. The program is started from the command-line, however the retrieval of images is done via whatver UI of the scanner happens to be.

    There are other utilities that do things like append image files together, start database engines, etc. These are not "low-level", as GUI wrappers can and have been written for these types of programs.
    If you see those "Teach yourself VC++ ... in 21 days" or Jeff Prosise's MFC programming kind of books, they don't even mention the command line. All they ever talk about are C++ code, VC++ software usage and MFC.
    And if you were to get general C++ books, no mention is made of GUI, clicking on icons or anything else. You are only given a C++ program, similar to what I posted.
    IMO, it's possible for a Windows programmer to write functional Windows programmers without even knowing there's such a thing called "command line".
    Try to find a Windows job with not knowing anything about simple comand-line commands. You will get strange looks by anyone who is a Windows professional in C++, no matter what applications they happen to be producing, whether they are all GUI, low level, mid level or whatever.
    You should laugh more and be more tolerant of noobs.
    The ironic thing is that general C++ books for newbies assume you know how to use the command-line.

    Regards,

    Paul McKenzie
    Last edited by Paul McKenzie; August 27th, 2008 at 11:09 AM.

  11. #26
    Join Date
    Apr 1999
    Posts
    27,449

    Re: Need a simple program!

    Quote Originally Posted by Xeon
    Why does he need VC++? If I still had my VC++ compiler, I just need to paste the folder-looping code and compile the program into an EXE file and send the file to him, and he'll place the file in his folder and execute the program and it'll do the rest.
    I am referring to the simle "Hello World" program that I posted. Also by "friend", I could also mean any other computer that doesn't have VC++ installed.
    Actually, for the command line, I only know how to open the window (Start menu > Run > command).
    And the only commands I know of are: cd and dir.
    Hopefully you also know how to run executable programs. All you need to do is type in the name of the exe and hit enter.
    As long as the Windows programmer isn't creating any low-level software, he doesn't even need to know how to use the command line.
    I'll add that many Java programmers will disagree with you.

    Regards,

    Paul McKenzie
    Last edited by Paul McKenzie; August 27th, 2008 at 11:53 AM.

  12. #27
    Join Date
    Oct 2002
    Location
    Arkansas, USA
    Posts
    189

    Re: Need a simple program!

    Xeon,
    One last tidbit of info regarding Windows Command line stuff... Most all of the built-in functions (like cd) offer some help (sort of like UNIX man pages).
    If you want to learn more about a command, type the name of the command follwed by a space and an then /? like this:
    C:\>cd /?
    If help is available (it is for the cd command), the help information for the related command will be output to the command window for your review.

    If you want to learn more about other command line tools that come with the Windows cmd shell, type help at the command line prompt. It will return a pretty good list of useful utilities and a brief summary of what those commands do.

  13. #28
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Need a simple program!

    Xeon trolling today?

  14. #29
    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    3,654

    Re: Need a simple program!

    Quote Originally Posted by gjs368
    (Just like MS to go half-way by letting you use spaces and then have grief over trying to get there....)
    Well, it's the same for every shell, something has to be done to indicate that it's not parameters. In Linux (Debian) the standard way is using \ before every space character, can't say that's better (quotes are supported as well)

    Edit: By the way, it took a long time but the shell now (since NT4 I think) have one of the *nix shell's handy functions "TAB to complete the line"

    Try typing cd and then hit TAB and a dir will be added to your command line. If it's not the correct dir hit TAB again until it is. Giving the first character of the dir before pressing TAB speeds it up even more.
    Last edited by S_M_A; August 31st, 2008 at 04:47 PM.
    Debugging is twice as hard as writing the code in the first place.
    Therefore, if you write the code as cleverly as possible, you are, by
    definition, not smart enough to debug it.
    - Brian W. Kernighan

    To enhance your chance's of getting an answer be sure to read
    http://www.codeguru.com/forum/announ...nouncementid=6
    and http://www.codeguru.com/forum/showthread.php?t=366302 before posting

    Refresh your memory on formatting tags here
    http://www.codeguru.com/forum/misc.php?do=bbcode

    Get your free MS compiler here
    https://visualstudio.microsoft.com/vs

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured