Click here to Skip to main content
15,905,427 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: werwerwe Pin
MailtoGops24-Aug-05 21:23
MailtoGops24-Aug-05 21:23 
GeneralRe: werwerwe Pin
ThatsAlok24-Aug-05 21:56
ThatsAlok24-Aug-05 21:56 
GeneralRe: werwerwe Pin
ashwath200524-Aug-05 22:26
ashwath200524-Aug-05 22:26 
GeneralRe: werwerwe Pin
ThatsAlok24-Aug-05 23:31
ThatsAlok24-Aug-05 23:31 
GeneralRe: werwerwe Pin
toxcct25-Aug-05 0:08
toxcct25-Aug-05 0:08 
GeneralRe: werwerwe Pin
toxcct24-Aug-05 23:03
toxcct24-Aug-05 23:03 
QuestionManagedMFC? Pin
Uwe Keim24-Aug-05 20:11
sitebuilderUwe Keim24-Aug-05 20:11 
Generalreplies recived for"problems in file reading,Suggest best method"did not work Pin
a_david12324-Aug-05 20:02
a_david12324-Aug-05 20:02 
Respected All
Regards

I sent a thread yesterday and also recived replies from respectable members but unluckily that did not work,
my post was.
-----------------------------
Respected all

Reagrds!
thanks for replies,but unluckily those did not work.

my yesterday query was.
---------------------------------------------
Respected All

I am engaged with filereading problem since long time, i readed the file but still problems are coming.
the dat file is in the following form.
-----------------------------------------
;sfad
;sdlfgs
;sdfjsd
;X Y Index
12 12 1233
34 45 1244
66 44 2435
45 23 3455
;fgksdghkdfhgdf
;dflghfd
23 67 6788
23 45 2334
-------------------------------------

now in the above file format i has to read only the lines that's starting without SEMICOLON and all the lines starting eith SEMICOLON has to skipp.and also while reading each line of the file I has to put the X,Y and Index value in seperate Array and the same process will be repeated each time for X,Y and Index value.
my code script is following
---------------------------------------
int val1,val2,val3;
int row=0;
char str4[50];
pfile=fopen("filename.dat",r)
do
{
fgets(str4,sizeof(str4),pfile);

if(str4[0]!=';')
{
fscanf(pfile,"%d",val1)
arr1[row]=val1;
fscanf(pfile,"%d",val2)
arr2[row]=val2;
fsacnf(pfile,"%d",val3)
arr3[row]=val3;
row++
}
while(!feof(pfile))
fclose(pfile);
-----------------------------
its reads all the data correctly but when there is a SEMICOLON in the start of the line then its skipp the next one line(immediate lines) and reads after it.
in the above case it skipp the line
12 12 1233
and
23 67 6788
because before these two lines there was a SEMICOLON line and due to it skipp the immediate lines.
and except these 2 lines it reads all the lines accordingly,
I dont know why this problem is coming,, pls guide me that what is the best method in this case while i am reading the above file format.


waiting for + response.
------------------------------------------------------------------
The respected members suggests that use
int val1,val2,val3;
int row=0;
char str4[50];
pfile=fopen("filename.dat",r)
do
{
fgets(str4,sizeof(str4),pfile);

if(str4[0]!=';')
{
sscanf(str4,"%d",val1)
arr1[row]=val1;
sscanf(str4,"%d",val2)
arr2[row]=val2;
ssacnf(str4,"%d",val3)
arr3[row]=val3;
row++
}
while(!feof(pfile))
fclose(pfile);

--------------------end of thread----------------
remember that i am working on VC(MFC) envirnment,
but after execution like the above code it give error,and the error window come although there is execution error and compilation is succeffull.but did not execute.so if any MFC related method then kindldy guideme

so needs suggestion 1ce again,plz.






david
GeneralRe: replies recived for"problems in file reading,Suggest best method"did not work Pin
Rage24-Aug-05 20:37
professionalRage24-Aug-05 20:37 
GeneralRe: replies recived for"problems in file reading,Suggest best method"did not work Pin
MailtoGops24-Aug-05 21:00
MailtoGops24-Aug-05 21:00 
Generaltutorial help Pin
Neelesh K J Jain24-Aug-05 19:51
Neelesh K J Jain24-Aug-05 19:51 
GeneralRe: tutorial help Pin
dharani25-Aug-05 17:43
dharani25-Aug-05 17:43 
GeneralRegarding InstallShield Pin
Neelesh K J Jain24-Aug-05 19:50
Neelesh K J Jain24-Aug-05 19:50 
GeneralFont Size Pin
TssPrasad24-Aug-05 18:22
sussTssPrasad24-Aug-05 18:22 
GeneralRe: Font Size Pin
MailtoGops24-Aug-05 19:29
MailtoGops24-Aug-05 19:29 
GeneralRe: Font Size Pin
TssPrasad24-Aug-05 19:54
sussTssPrasad24-Aug-05 19:54 
GeneralRe: Font Size Pin
Aamir Butt25-Aug-05 0:46
Aamir Butt25-Aug-05 0:46 
GeneralClearing the Buffer in a MFC View Pin
suzie10024-Aug-05 16:51
suzie10024-Aug-05 16:51 
GeneralRe: Clearing the Buffer in a MFC View Pin
Christian Graus24-Aug-05 17:31
protectorChristian Graus24-Aug-05 17:31 
GeneralRe: Clearing the Buffer in a MFC View Pin
suzie10024-Aug-05 18:50
suzie10024-Aug-05 18:50 
GeneralRe: Clearing the Buffer in a MFC View Pin
MailtoGops24-Aug-05 19:26
MailtoGops24-Aug-05 19:26 
QuestionHow to drag a customaze struct and drop? Pin
freehawk24-Aug-05 15:54
freehawk24-Aug-05 15:54 
GeneralERROR_MORE_DATA on RegQueryValueEx() Pin
KingTermite24-Aug-05 14:43
KingTermite24-Aug-05 14:43 
GeneralRe: ERROR_MORE_DATA on RegQueryValueEx() Pin
KingTermite25-Aug-05 4:28
KingTermite25-Aug-05 4:28 
GeneralRe: ERROR_MORE_DATA on RegQueryValueEx() Pin
Blake Miller25-Aug-05 4:59
Blake Miller25-Aug-05 4:59 

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.