Thread: Weird command prompt error, program not working..

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Absent Minded Programmer
    Join Date
    May 2005
    Posts
    968

    Weird command prompt error, program not working..

    Whenever I run my console application, it's going to be a simple blackjack game, I get this weird command prompt error, I think it might happen with any new precompiled header console application.

    Code:
    '\\intellimark\dfs\Home\jcoleman\My Documents\Visual Studio 2005\Projects\Blackj
    ack\Blackjack'
    CMD.EXE was started with the above path as the current directory.
    UNC paths are not supported.  Defaulting to Windows directory.
    And the program simply does not run, here is what I'm trying to do by the way, simply output the value of a card in the deck.

    Code:
    int _tmain(int argc, _TCHAR* argv[])
    {
    	Deck BlackJackDeck;
    	std::cout << BlackJackDeck.Cards[3].suit << std::endl;
    	std::cout << BlackJackDeck.Cards[3].value << std::endl;
    	return 0;
    }
    Not too complicated stuff here, but that weird console error... I'm working with Microsoft Visual Studio 2005 C++ Express Edition

    Can anyone help me?
    Sometimes I forget what I am doing when I enter a room, actually, quite often.

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    You are probably trying to run this from a different machine than the one you are currently using. I think this is caused by the fact that your "home" drive is not on the machine you are working. Not quite sure how you work around it, just trying to explain what the situation is.

    Guessing on a solution: You could probably try to copy the executable file to a local drive, perhaps.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Absent Minded Programmer
    Join Date
    May 2005
    Posts
    968
    Yeah I'm working on a network at my work desk. My documents is located on a network drive. I'll try doing what you suggested.
    Sometimes I forget what I am doing when I enter a room, actually, quite often.

  4. #4
    Absent Minded Programmer
    Join Date
    May 2005
    Posts
    968
    Okay I got it to run, without any console errors, but there is no output, I'll show you my code, could you tell if I'm doing anything incorrectly?

    Code:
    // Blackjack.cpp : Defines the entry point for the console application.
    //
    
    #include "stdafx.h"
    #include <iostream>
    
    struct Card
    {
    	int suit;
    	int value;
    };
    
    class Deck
    {
    public:
    	Deck()
    	{
    		int x;
    		int y;
    		int z = 0;
    		while(z < 52)
    		{
    			for (y = 0; y > 3;  y++)
    			{
    				for (x = 0; x > 13; x++)
    				{
    					Cards[z].suit = y;
    					Cards[z].value = x;
    					z++;
    				}
    			}
    		}
    	}
    
    //private:
    	Card Cards[51];
    };
    
    
    int _tmain(int argc, _TCHAR* argv[])
    {
    	Deck BlackJackDeck;
    	std::cout << BlackJackDeck.Cards[3].suit << std::endl;
    	std::cout << BlackJackDeck.Cards[3].value << std::endl;
    	return 0;
    }
    The Deck constructor simply assigns all the cards a value with a loop, I'm going to eventually switch it to a vector instead of a simple array so I can do things like shuffling and whatnot, maybe a list would be better.

    Anyways, I'm getting no output when I run the program, any solutions?
    Sometimes I forget what I am doing when I enter a room, actually, quite often.

  5. #5
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    There is "no output" or the output disappears so quickly that you haven't got time to read it? If it's the latter, perhaps adding a "cin.ignore()" would work. That will require some input from the console, so you have to hit enter before it exits the application.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  6. #6
    Absent Minded Programmer
    Join Date
    May 2005
    Posts
    968
    Yeah I don't see anything at all in the console, not even a press enter to exit or anything like that, its just empty.

    Weird.
    Sometimes I forget what I am doing when I enter a room, actually, quite often.

  7. #7
    Registered User hk_mp5kpdw's Avatar
    Join Date
    Jan 2002
    Location
    Northern Virginia/Washington DC Metropolitan Area
    Posts
    3,817
    Code:
    for (y = 0; y > 3;  y++)
    {
        for (x = 0; x > 13; x++)
        {
            Cards[z].suit = y;
            Cards[z].value = x;
            z++;
        }
    }
    
    ...
    
    Card Cards[51];
    Whoops?
    "Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
    -Christopher Hitchens

  8. #8
    Registered User hk_mp5kpdw's Avatar
    Join Date
    Jan 2002
    Location
    Northern Virginia/Washington DC Metropolitan Area
    Posts
    3,817
    Code:
    class Deck
    {
    public:
        Deck()
        {
            int x;
            int y;
            int z = 0;
            for (y = 0; y < 4;  y++)
            {
                for (x = 0; x < 13; x++)
                {
                    Cards[z].suit = y;
                    Cards[z].value = x;
                    z++;
                }
            }
        }
    
    
    //private:
    	Card Cards[52];
    };
    "Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
    -Christopher Hitchens

  9. #9
    Absent Minded Programmer
    Join Date
    May 2005
    Posts
    968
    awesome its all fixed up now, thanks for your help guys

    Code:
    struct Card
    {
    	int suit;
    	int value;
    };
    
    class Deck
    {
    public:
    	Deck()
    	{
    		int x;
    		int y;
    		int z = 0;
    			for (y = 0; y < 4;  y++)
    			{
    				for (x = 0; x < 13; x++)
    				{
    					Cards[z].suit = y;
    					Cards[z].value = x;
    					z++;
    				}
    			}
    	}
    
    
    //private:
    	Card Cards[52];
    };
    Sometimes I forget what I am doing when I enter a room, actually, quite often.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. weird things with my linked list of queue
    By -EquinoX- in forum C Programming
    Replies: 3
    Last Post: 11-22-2008, 11:23 PM
  2. some really weird problems with string !
    By mellisa in forum C++ Programming
    Replies: 2
    Last Post: 01-20-2003, 04:56 AM
  3. cygwin -> unix , my code not working properly ;(
    By CyC|OpS in forum C Programming
    Replies: 4
    Last Post: 05-18-2002, 04:08 AM
  4. Direct Draw weird stuff
    By Magos in forum C++ Programming
    Replies: 6
    Last Post: 04-24-2002, 04:39 AM
  5. getting current working filename
    By Unregistered in forum C++ Programming
    Replies: 1
    Last Post: 04-17-2002, 03:42 PM