Click here to Skip to main content
15,902,832 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRepresent font size..?? Pin
TssPrasad24-Aug-05 1:09
sussTssPrasad24-Aug-05 1:09 
AnswerRe: Represent font size..?? Pin
Nishad S24-Aug-05 1:41
Nishad S24-Aug-05 1:41 
Generalproblem of transfering file from one pc 2 another Pin
manishgandhi24-Aug-05 0:47
manishgandhi24-Aug-05 0:47 
GeneralRe: problem of transfering file from one pc 2 another Pin
kakan24-Aug-05 1:00
professionalkakan24-Aug-05 1:00 
GeneralRe: problem of transfering file from one pc 2 another Pin
ThatsAlok24-Aug-05 18:38
ThatsAlok24-Aug-05 18:38 
GeneralADPCM format Pin
harrykouk24-Aug-05 0:43
harrykouk24-Aug-05 0:43 
GeneralRe: ADPCM format Pin
David Crow24-Aug-05 4:00
David Crow24-Aug-05 4:00 
Generalprobelms in file reading ,,suggest best method Pin
a_david12324-Aug-05 0:42
a_david12324-Aug-05 0:42 
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.





david
GeneralRe: probelms in file reading ,,suggest best method Pin
Mukhan24-Aug-05 1:26
Mukhan24-Aug-05 1:26 
GeneralRe: probelms in file reading ,,suggest best method Pin
David Crow24-Aug-05 3:55
David Crow24-Aug-05 3:55 
GeneralRe: probelms in file reading ,,suggest best method Pin
Jose Lamas Rios24-Aug-05 3:50
Jose Lamas Rios24-Aug-05 3:50 
GeneralRe: probelms in file reading ,,suggest best method Pin
David Crow24-Aug-05 3:54
David Crow24-Aug-05 3:54 
Generalmemcmp & bitmaps Pin
dave2k24-Aug-05 0:13
dave2k24-Aug-05 0:13 
GeneralRe: memcmp & bitmaps Pin
Anonymous24-Aug-05 3:58
Anonymous24-Aug-05 3:58 
GeneralAdding new column dynamically in CXListCtrl adds progress control and check boxs... Pin
Ravi Sankar S23-Aug-05 23:58
Ravi Sankar S23-Aug-05 23:58 
GeneralAssistance required on Bitmaps Pin
Barm23-Aug-05 23:50
Barm23-Aug-05 23:50 
GeneralRe: Assistance required on Bitmaps Pin
Steve S23-Aug-05 23:54
Steve S23-Aug-05 23:54 
GeneralRe: Assistance required on Bitmaps Pin
Barm24-Aug-05 0:01
Barm24-Aug-05 0:01 
GeneralRe: Assistance required on Bitmaps Pin
Hamed Musavi24-Aug-05 1:19
Hamed Musavi24-Aug-05 1:19 
GeneralRe: Assistance required on Bitmaps Pin
Achim Klein24-Aug-05 8:14
Achim Klein24-Aug-05 8:14 
GeneralCheckBox control problem Pin
Mukhan23-Aug-05 22:43
Mukhan23-Aug-05 22:43 
GeneralRe: CheckBox control problem Pin
Rage23-Aug-05 22:48
professionalRage23-Aug-05 22:48 
GeneralRe: CheckBox control problem Pin
Mukhan23-Aug-05 23:02
Mukhan23-Aug-05 23:02 
GeneralFile Transfer Using UDP Pin
yccheok23-Aug-05 22:17
yccheok23-Aug-05 22:17 
GeneralRe: File Transfer Using UDP Pin
Alexander M.,23-Aug-05 22:37
Alexander M.,23-Aug-05 22:37 

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.