hi,
Thank you for the replies. i was just trying to understand how the file data will be stored in the computer. Because if i write a program like this
Code:
#include <stdio.h>
#include <string.h>
int main(int argc, char *argv[])
{
FILE *fp;
char str[50];
fp = fopen("out.txt","r");
if(fp == NULL)
{
printf("error opening file\n");
return 0;
}
else
{
while(fgets(str,40,fp) != NULL)
{
printf("%s",str);
}
}
return 0;
}
and the out.txt file contains the following text as attached. The output is the same as out.txt with the '\n' character
Code:
hai this is \n satya
i am fine here
compared to the previous output which printed on the new line.
so it basically handles the file data differently compared to a string data, can you direct or give a link how it will store because if you give as a string it prints in the new line whereas if you give it in a file it just prints '\n'. But thanks for the quick replies.
Thanks and regards,
Satya