Click here to Skip to main content
15,887,135 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Better "pattern" for if-else if for strings ? Pin
CPallini24-Aug-12 1:53
mveCPallini24-Aug-12 1:53 
GeneralRe: Better "pattern" for if-else if for strings ? Pin
pasztorpisti24-Aug-12 2:20
pasztorpisti24-Aug-12 2:20 
GeneralRe: Better "pattern" for if-else if for strings ? Pin
Maximilien24-Aug-12 4:04
Maximilien24-Aug-12 4:04 
AnswerRe: Better "pattern" for if-else if for strings ? Pin
bkelly1326-Aug-12 15:55
bkelly1326-Aug-12 15:55 
Questionrun bat file using ShellExecute Pin
manju 323-Aug-12 2:16
manju 323-Aug-12 2:16 
AnswerRe: run bat file using ShellExecute Pin
Chris Meech23-Aug-12 2:20
Chris Meech23-Aug-12 2:20 
AnswerRe: run bat file using ShellExecute Pin
pasztorpisti23-Aug-12 3:07
pasztorpisti23-Aug-12 3:07 
QuestionWrite to Text file using fprintf Pin
manju 323-Aug-12 1:06
manju 323-Aug-12 1:06 
Hi all,
I am trying to write one string to a file.But i am getting only one character
saved in my Text.txt file.Output text file contains only "a" in it.
How can i get whole string saved in my text file.
Here is the code i am trying:
FILE *fptr;
CString Text;
Text = "asdasdasdasd";
fptr = fopen("D:\\Test.txt","w+");
if(fptr== NULL)
   exit(1);
fprintf(fptr ,"%s",Text);
fclose(fptr);


If i write it as ""asdasdasdasd"" instead of passing the CString,it writes in the text file
fprintf(fptr ,"%s",""asdasdasdasd"");


Can anyone help me,where i am going wrong.

Thanks
Manju
AnswerRe: Write to Text file using fprintf Pin
Richard MacCutchan23-Aug-12 1:56
mveRichard MacCutchan23-Aug-12 1:56 
GeneralRe: Write to Text file using fprintf Pin
CPallini23-Aug-12 22:55
mveCPallini23-Aug-12 22:55 
GeneralRe: Write to Text file using fprintf Pin
Richard MacCutchan23-Aug-12 23:47
mveRichard MacCutchan23-Aug-12 23:47 
GeneralRe: Write to Text file using fprintf Pin
CPallini25-Aug-12 7:25
mveCPallini25-Aug-12 7:25 
GeneralRe: Write to Text file using fprintf Pin
Richard MacCutchan25-Aug-12 7:29
mveRichard MacCutchan25-Aug-12 7:29 
AnswerRe: Write to Text file using fprintf Pin
pasztorpisti23-Aug-12 1:59
pasztorpisti23-Aug-12 1:59 
AnswerRe: Write to Text file using fprintf Pin
_AnsHUMAN_ 23-Aug-12 2:00
_AnsHUMAN_ 23-Aug-12 2:00 
AnswerRe: Write to Text file using fprintf Pin
Richard MacCutchan23-Aug-12 23:46
mveRichard MacCutchan23-Aug-12 23:46 
Question[SOLVED] Missing Include File Pin
Richard Andrew x6422-Aug-12 19:14
professionalRichard Andrew x6422-Aug-12 19:14 
QuestionError conveting VS 2008 project to VS 2010 project Pin
ForNow21-Aug-12 14:49
ForNow21-Aug-12 14:49 
AnswerRe: Error conveting VS 2008 project to VS 2010 project Pin
Richard MacCutchan21-Aug-12 22:36
mveRichard MacCutchan21-Aug-12 22:36 
GeneralRe: Error conveting VS 2008 project to VS 2010 project Pin
ForNow22-Aug-12 2:17
ForNow22-Aug-12 2:17 
GeneralRe: Error conveting VS 2008 project to VS 2010 project Pin
Richard MacCutchan22-Aug-12 2:30
mveRichard MacCutchan22-Aug-12 2:30 
GeneralRe: Error conveting VS 2008 project to VS 2010 project Pin
ForNow22-Aug-12 2:42
ForNow22-Aug-12 2:42 
QuestionWhat happened to the forum? Pin
includeh1021-Aug-12 5:38
includeh1021-Aug-12 5:38 
AnswerRe: What happened to the forum? Pin
Richard Andrew x6421-Aug-12 7:04
professionalRichard Andrew x6421-Aug-12 7:04 
AnswerThen, please, leave my dear. Pin
CPallini21-Aug-12 7:04
mveCPallini21-Aug-12 7:04 

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.