Click here to Skip to main content
15,898,371 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Getting #include {iostream} to work Pin
Randor 29-Jun-09 5:10
professional Randor 29-Jun-09 5:10 
AnswerRe: Getting #include {iostream} to work Pin
PJ Arends29-Jun-09 6:13
professionalPJ Arends29-Jun-09 6:13 
QuestionUsing the CRegistry class Pin
Larry Mills Sr29-Jun-09 2:48
Larry Mills Sr29-Jun-09 2:48 
QuestionRe: Using the CRegistry class Pin
David Crow29-Jun-09 3:19
David Crow29-Jun-09 3:19 
AnswerRe: Using the CRegistry class Pin
Larry Mills Sr29-Jun-09 7:42
Larry Mills Sr29-Jun-09 7:42 
QuestionRe: Using the CRegistry class Pin
David Crow29-Jun-09 7:45
David Crow29-Jun-09 7:45 
AnswerRe: Using the CRegistry class Pin
Joschwenk6668-Mar-10 1:14
Joschwenk6668-Mar-10 1:14 
QuestionIs it right? Pin
Razanust29-Jun-09 2:35
Razanust29-Jun-09 2:35 
My object is to find the size of the text file without traversing the characters. I wrote the following code:

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
main()
{
int lno=1,n=0,x=2;
long position=0;
char ch[1000],s[1000];
FILE*fp;
fp=fopen("imp.txt","r");

if (fp==NULL)
{puts("Cannot open file");
exit(1);}
printf("01 ");

while(1)
{
ch[n]=fgetc(fp);
n=n+1;

if (ch[n-1]==EOF)
break;
if (ch[n-1]=='\n')
{printf("\n0%d ",x);
x=x+1;}
else if (ch[n-1]!='\r')
{
printf("%c",ch[n-1]);}
else if (ch[n-1]=='\r')
{continue;}
}
fseek(fp,0,SEEK_END);
position=ftell(fp);
printf("\n\n Size of the text file is %ld bytes\n ",position);
fclose(fp);
}



FILE DATA:
Hello
Roger here
Keep it up
Please reply



The size given by this code is 43 bytes while what i am getting on my windows is 638 bytes. Is this right? If yes then Why?
AnswerRe: Is it right? Pin
chandu00429-Jun-09 2:41
chandu00429-Jun-09 2:41 
AnswerRe: Is it right? Pin
«_Superman_»29-Jun-09 2:55
professional«_Superman_»29-Jun-09 2:55 
Questionhide the console window while using system(...) Pin
chandu00429-Jun-09 1:37
chandu00429-Jun-09 1:37 
QuestionRe: hide the console window while using system(...) Pin
Rajesh R Subramanian29-Jun-09 1:43
professionalRajesh R Subramanian29-Jun-09 1:43 
AnswerRe: hide the console window while using system(...) Pin
chandu00429-Jun-09 1:48
chandu00429-Jun-09 1:48 
GeneralRe: hide the console window while using system(...) Pin
Rajesh R Subramanian29-Jun-09 1:59
professionalRajesh R Subramanian29-Jun-09 1:59 
GeneralRe: hide the console window while using system(...) Pin
chandu00429-Jun-09 2:09
chandu00429-Jun-09 2:09 
GeneralRe: hide the console window while using system(...) Pin
«_Superman_»29-Jun-09 2:31
professional«_Superman_»29-Jun-09 2:31 
GeneralRe: hide the console window while using system(...) Pin
chandu00429-Jun-09 2:36
chandu00429-Jun-09 2:36 
GeneralRe: hide the console window while using system(...) Pin
«_Superman_»29-Jun-09 2:50
professional«_Superman_»29-Jun-09 2:50 
GeneralRe: hide the console window while using system(...) Pin
chandu00429-Jun-09 3:08
chandu00429-Jun-09 3:08 
GeneralRe: hide the console window while using system(...) Pin
«_Superman_»29-Jun-09 3:09
professional«_Superman_»29-Jun-09 3:09 
GeneralRe: hide the console window while using system(...) Pin
David Crow29-Jun-09 3:23
David Crow29-Jun-09 3:23 
GeneralRe: hide the console window while using system(...) Pin
chandu00429-Jun-09 3:47
chandu00429-Jun-09 3:47 
GeneralRe: hide the console window while using system(...) Pin
David Crow29-Jun-09 4:14
David Crow29-Jun-09 4:14 
GeneralRe: hide the console window while using system(...) Pin
chandu00430-Jun-09 21:41
chandu00430-Jun-09 21:41 
AnswerRe: hide the console window while using system(...) Pin
«_Superman_»29-Jun-09 1:44
professional«_Superman_»29-Jun-09 1:44 

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.