Click here to Skip to main content
16,012,316 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: GetOpenFileName Pin
Ravi Bhavnani26-Oct-03 14:29
professionalRavi Bhavnani26-Oct-03 14:29 
QuestionHow do I increment a char? Pin
JasonKaiser26-Oct-03 11:43
JasonKaiser26-Oct-03 11:43 
AnswerRe: How do I increment a char? Pin
georgiek5026-Oct-03 12:09
georgiek5026-Oct-03 12:09 
GeneralRe: How do I increment a char? Pin
JasonKaiser26-Oct-03 12:51
JasonKaiser26-Oct-03 12:51 
GeneralRe: How do I increment a char? Pin
georgiek5026-Oct-03 14:07
georgiek5026-Oct-03 14:07 
GeneralCArray for GCC Pin
Sergei Yevseyev26-Oct-03 11:16
Sergei Yevseyev26-Oct-03 11:16 
GeneralRe: CArray for GCC Pin
Christian Graus26-Oct-03 13:02
protectorChristian Graus26-Oct-03 13:02 
Generalproblem with file scanning Pin
karteek26-Oct-03 6:09
karteek26-Oct-03 6:09 
Hi,
I wrote a console application.In this I want to read a file and write into another file.The first number in the input file gives the number of characters in the file.
My program is as follows:
char ch;
int i=0,n,j=0;
char data[9];
FILE *fp=fopen("input.txt","r");
FILE *fp1=fopen("output.txt","w");
fscanf(fp,"%d",&n);

while(j<=n)
{
j++;
ch=fgetc(fp);
fprintf(fp1,"%c",ch);
}
fclose(fp);
fclose(fp1);

Input file on which it is not working:--
160 e‘Ünýv¾§–yDBwŠÑûhŠ[ŠÑûhŠ[ŠÑûhŠ[ŠÑûhŠ[ŠÑûhŠ[ŠÑûhŠ[ŠÑûhŠ[±³~%IШƻѡ¸#M$=¹»z÷Ê‚ÉyÀ¨fza÷Aœ,®áÀŽ¥L”vP_üã†ÉÖU´¥šÁ×ÕVI¶÷kúÎEu„~:
†í•BØ
hmg¸

Output file given:--
e‘Ünýv¾§–yDBwŠÑûhŠ[ŠÑûhŠ[ŠÑûhŠ[ŠÑûhŠ[ŠÑûhŠ[ŠÑûhŠ[ŠÑûhŠ[±³~%IШƻѡ¸#M$=¹»zÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ

Please help me in finding out the problem

Karteek
GeneralRe: problem with file scanning Pin
Dominik Reichl26-Oct-03 6:59
Dominik Reichl26-Oct-03 6:59 
GeneralSize of exe file Pin
Anonymous26-Oct-03 4:55
Anonymous26-Oct-03 4:55 
GeneralRe: Size of exe file Pin
Gary R. Wheeler26-Oct-03 5:04
Gary R. Wheeler26-Oct-03 5:04 
GeneralRe: Size of exe file Pin
igor196026-Oct-03 9:57
igor196026-Oct-03 9:57 
GeneralRe: Size of exe file Pin
Gary R. Wheeler27-Oct-03 11:13
Gary R. Wheeler27-Oct-03 11:13 
GeneralArrays, heap, delete and crash again... Pin
Rickard Andersson2026-Oct-03 4:41
Rickard Andersson2026-Oct-03 4:41 
GeneralRe: Arrays, heap, delete and crash again... Pin
Gary R. Wheeler26-Oct-03 4:55
Gary R. Wheeler26-Oct-03 4:55 
GeneralRe: Arrays, heap, delete and crash again... Pin
Jörgen Sigvardsson26-Oct-03 5:31
Jörgen Sigvardsson26-Oct-03 5:31 
GeneralRe: Arrays, heap, delete and crash again... Pin
Michael Dunn26-Oct-03 6:00
sitebuilderMichael Dunn26-Oct-03 6:00 
GeneralRe: Arrays, heap, delete and crash again... Pin
Jörgen Sigvardsson26-Oct-03 6:02
Jörgen Sigvardsson26-Oct-03 6:02 
GeneralRe: Arrays, heap, delete and crash again... Pin
Michael Dunn26-Oct-03 6:51
sitebuilderMichael Dunn26-Oct-03 6:51 
GeneralRe: Arrays, heap, delete and crash again... Pin
Jörgen Sigvardsson26-Oct-03 12:07
Jörgen Sigvardsson26-Oct-03 12:07 
GeneralRe: Arrays, heap, delete and crash again... Pin
Rickard Andersson2026-Oct-03 11:55
Rickard Andersson2026-Oct-03 11:55 
GeneralRe: Arrays, heap, delete and crash again... Pin
Jörgen Sigvardsson26-Oct-03 12:05
Jörgen Sigvardsson26-Oct-03 12:05 
GeneralRe: Arrays, heap, delete and crash again... Pin
Rickard Andersson2026-Oct-03 11:53
Rickard Andersson2026-Oct-03 11:53 
GeneralCompletely and Totally OT Pin
Atlantys27-Oct-03 10:43
Atlantys27-Oct-03 10:43 
GeneralRe: Completely and Totally OT Pin
Michael Dunn27-Oct-03 12:14
sitebuilderMichael Dunn27-Oct-03 12:14 

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.