Click here to Skip to main content
16,006,440 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: copy folder Pin
Ravi Bhavnani22-Oct-05 8:42
professionalRavi Bhavnani22-Oct-05 8:42 
GeneralRe: copy folder Pin
stef880322-Oct-05 9:08
stef880322-Oct-05 9:08 
GeneralRe: copy folder Pin
Ravi Bhavnani22-Oct-05 13:43
professionalRavi Bhavnani22-Oct-05 13:43 
GeneralRe: copy folder Pin
Michael Dunn22-Oct-05 8:32
sitebuilderMichael Dunn22-Oct-05 8:32 
GeneralRe: copy folder Pin
stef880322-Oct-05 23:19
stef880322-Oct-05 23:19 
QuestionI want to learn vc++ Pin
yashmitl22-Oct-05 7:11
yashmitl22-Oct-05 7:11 
AnswerRe: I want to learn vc++ Pin
Ravi Bhavnani22-Oct-05 8:14
professionalRavi Bhavnani22-Oct-05 8:14 
QuestionBasic input from console but program crashes ! Pin
Aditi48422-Oct-05 4:27
Aditi48422-Oct-05 4:27 
Hello..

I'm very new to visual C++ , I'm using a console application in Microsoft Visual Studio. NET..

I have a simple application where I want to get some parameters from the user, so i ask the user for it but when i type the answer and press enter on the keyboard the program just crashes (application has encountered a problem..send error to microsoft)

this is my code:

 <br />
string host_name; <br />
<br />
printf("ENTER HOST NAME: "); <br />
<br />
//gets( host_name); <br />
	<br />
scanf("%s",host_name); <br />
<br />


I have the following include files in stdafx.h file:

#include <iostream>
#include <string.h>
#include <tchar.h>
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>

I tried declaring host_name as char* but it still crashes.. tries using gets() but doesnt as well..

I also tried doing it the C++ way as follows :

<br />
<br />
using namespace std; <br />
<br />
cout<< "ENTER HOST NAME: "; <br />
	cin >>host_name; <br />


And that also crashes the program..

Please tell me where the problem is.. Thank you for ur help..
AnswerRe: Basic input from console but program crashes ! Pin
Mircea Puiu22-Oct-05 4:36
Mircea Puiu22-Oct-05 4:36 
GeneralRe: Basic input from console but program crashes ! Pin
Aditi48422-Oct-05 5:17
Aditi48422-Oct-05 5:17 
GeneralRe: Basic input from console but program crashes ! Pin
Mircea Puiu22-Oct-05 5:59
Mircea Puiu22-Oct-05 5:59 
GeneralRe: Basic input from console but program crashes ! Pin
Aditi48422-Oct-05 6:54
Aditi48422-Oct-05 6:54 
GeneralRe: Basic input from console but program crashes ! Pin
Mircea Puiu22-Oct-05 10:15
Mircea Puiu22-Oct-05 10:15 
GeneralRe: Basic input from console but program crashes ! Pin
Aditi48423-Oct-05 21:08
Aditi48423-Oct-05 21:08 
GeneralRe: Basic input from console but program crashes ! Pin
Mircea Puiu23-Oct-05 21:27
Mircea Puiu23-Oct-05 21:27 
GeneralRe: Basic input from console but program crashes ! Pin
Aditi48423-Oct-05 22:19
Aditi48423-Oct-05 22:19 
GeneralRe: Basic input from console but program crashes ! Pin
Mircea Puiu23-Oct-05 22:57
Mircea Puiu23-Oct-05 22:57 
Questionwhat dose &quot;afx&quot; mean? Pin
ewighell22-Oct-05 4:00
ewighell22-Oct-05 4:00 
AnswerRe: what dose &quot;afx&quot; mean? Pin
Mircea Puiu22-Oct-05 4:23
Mircea Puiu22-Oct-05 4:23 
AnswerRe: what dose &quot;afx&quot; mean? Pin
rlasaca22-Oct-05 5:09
rlasaca22-Oct-05 5:09 
AnswerRe: what dose &quot;afx&quot; mean? Pin
Chris Losinger22-Oct-05 5:15
professionalChris Losinger22-Oct-05 5:15 
GeneralRe: what dose &quot;afx&quot; mean? Pin
FarPointer22-Oct-05 6:07
FarPointer22-Oct-05 6:07 
GeneralRe: what dose &quot;afx&quot; mean? Pin
Michael Dunn22-Oct-05 6:23
sitebuilderMichael Dunn22-Oct-05 6:23 
GeneralRe: what dose &quot;afx&quot; mean? Pin
ewighell22-Oct-05 5:44
ewighell22-Oct-05 5:44 
Questioncompile errors with GDI Pin
j_penbert22-Oct-05 3:34
j_penbert22-Oct-05 3:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.