|
if you look at the fgets()[^] function behavior, it waits for a "maximum characters to read" parameter ; so i believe that your problem comes from the length of your buffer (if you read a line which is wider that your buffer, it will be truncated)
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
|
|
|
|
|
no , i put n=1000 and ... is less than 100 characters .
and also when i read :
dsalgujbslgkusdhglidsufhgllkufg
it is true but
<#if dsgubsldfjgblfdgbldfgb #>
is false !!!!!!!!!!!!!!!!!!!!!!!!!
i dont know why fgets act like this .
|
|
|
|
|
use you debugger to compare the string you read and what is actually filled in your buffer.
btw, do you have any \n, spaces or escape characters in the string read ?
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
|
|
|
|
|
I haven't any '\n' , space and scape . this is what happens :
the file is:
<#if...#>
hello
the code is: --------------- debugger shows :
char string[1000]="";
fgets("adress",1000,input);
fgets("adress",1000,input);
|
|
|
|
|
My be fgets("adress",1000,input) must be replaced with fgets(string,1000,input) ?
|
|
|
|
|
AH ofcourse it was a misprint , it is true in my code .
-- modified at 8:54 Tuesday 6th June, 2006
|
|
|
|
|
Can you post your code ? (With the opening of the file also)
Cédric Moonen
Software developer
Charting control
|
|
|
|
|
how can I post the files to you ?
|
|
|
|
|
Just post the relevant information here (the code snippet that opens and read from the files with the variables that are used). Please use the code tags (above the emoticons)
Cédric Moonen
Software developer
Charting control
|
|
|
|
|
code is :
int main()
{
char khat[1000];
clrscr();
int i;
for(i=0;i<1000;i++) {khat[i]='\0'; if(i<100)counter[i]=0;}
FILE *f;
f=fopen("falle//in2.htm","r");
for(i=1;i<1000;i++)
{
fgets(khat,1000,f);
printf("%s\n",khat);
if(strcmp(khat,"</HTML>")==0) break;
}
fclose(f);
char ch=getch();
if(ch==27) return 0;
return 0;
}
and file is :
<HTML>
<BODY>
<#if( 1+2^3 < 2*(2+3)+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1+1-1 )#>
correct
yes , it is correct
<#fi#>
incorect
<#loop 4#>
this is in the loop
and number is :
<#i#>
<#do#>
</BODY>
</HTML>
|
|
|
|
|
I think you should provide the entire fragment between the line where you open the file (fopen ) and close it (fclose ), and may be a precise content of input file. Perhaps, someone will figure out the problem.
If your program is too big, try to remove (comment) some fragments, keeping file-processing only. Thus you should be able to reproduce the problem for a smaller program.
|
|
|
|
|
How are you verifying the contents of string ?
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
hi all,
I have a video player that plays video files(.cam).Everthing is working fine.I can even able to extract audio and save it as .wav file.
This is the code where i record audio .
DWORD CWave::recordWAVEFile(DWORD dwMilliSeconds) <br />
{ <br />
UINT wDeviceID; <br />
DWORD dwReturn; <br />
MCI_OPEN_PARMS mciOpenParms; <br />
MCI_RECORD_PARMS mciRecordParms; <br />
MCI_SAVE_PARMS mciSaveParms; <br />
MCI_PLAY_PARMS mciPlayParms; <br />
<br />
mciOpenParms.lpstrDeviceType = "waveaudio"; <br />
mciOpenParms.lpstrElementName = ""; <br />
if (dwReturn = mciSendCommand(0, MCI_OPEN, <br />
MCI_OPEN_ELEMENT | MCI_OPEN_TYPE, <br />
(DWORD)(LPVOID) &mciOpenParms)) <br />
{ <br />
return (dwReturn); <br />
} <br />
<br />
wDeviceID = mciOpenParms.wDeviceID; <br />
<br />
mciRecordParms.dwTo = dwMilliSeconds; <br />
if (dwReturn = mciSendCommand(wDeviceID, MCI_RECORD, <br />
MCI_TO | MCI_WAIT, (DWORD)(LPVOID) &mciRecordParms)) <br />
{ <br />
mciSendCommand(wDeviceID, MCI_CLOSE, 0, NULL); <br />
return (dwReturn); <br />
} <br />
<br />
<br />
if (MessageBox(hMainWnd, "Do you want to save this recording?", <br />
"", MB_YESNO) == IDNO) <br />
{ <br />
mciSendCommand(wDeviceID, MCI_CLOSE, 0, NULL); <br />
return (0L); <br />
} <br />
<br />
mciSaveParms.lpfilename = "c:\\file.wav"; <br />
if (dwReturn = mciSendCommand(wDeviceID, MCI_SAVE, <br />
MCI_SAVE_FILE | MCI_WAIT, (DWORD)(LPVOID) &mciSaveParms)) <br />
{ <br />
mciSendCommand(wDeviceID, MCI_CLOSE, 0, NULL); <br />
return (dwReturn); <br />
} <br />
return (0L); <br />
}
But my problem,it takes more time to record and not allowing to play the video.
(recording is done at first)
Can I do recording the audio and playing video simultaneously..
help me please..
cheers
sangeet
|
|
|
|
|
If the save is a lenghty operation, then you can simply start a new thread in which you will do the saving.
Cédric Moonen
Software developer
Charting control
|
|
|
|
|
Greetings:
I am writing an MFC app with VS 2003. I am trying to track a memory leak. I have replaced all of my "new" keywords with "DEBUG_NEW" as per the Microsoft documentation on tracking MFC memory leaks.
All of my files contain the:
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
lines at the top and I am building in _DEBUG mode.
The compiler is issuing "identifier not found" for all instances of "DEBUG_NEW".
Does anybody know what the problem is?
Thanks in advance,
Mark
|
|
|
|
|
wrote: I am writing an MFC app with VS 2003. I am trying to track a memory leak. I have replaced all of my "new" keywords with "DEBUG_NEW" as per the Microsoft documentation on tracking MFC memory leaks.
All of my files contain the:
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
lines at the top and I am building in _DEBUG mode.
The compiler is issuing "identifier not found" for all instances of "DEBUG_NEW".
Does anybody know what the problem is?
Are you using precompiled headers??
if not then try including "Afx.h" file which contains the definition related to DEBUG_NEW macro.
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
Hi, thanks for your response.
Yes, I am using pre-compiled headers and I also added the include of "afx.h" to the top of all of my files, just for good measure. I am still getting the same result...
Bizarre...
|
|
|
|
|
|
I think you only need to add the definition for new , but you do not have to replace any appearance of your new operators with DEBUG_NEW .
|
|
|
|
|
You know, I think you're right. I misunderstood the documentation.
So that means that the memory dump data that I am getting in my output window is as good as it gets? Its not very helpful...
Oh, well...
Thanks for your help.
Mark
|
|
|
|
|
Hello
I want to open a file in binary mode in Turbo C++ , by using fopen()
and i need help
thank you
|
|
|
|
|
V_shr wrote: I want to open a file in binary mode in Turbo C++ , by using fopen()
What are you trying to do ? Could you be more specific ?
If you want to 'open the file in binary mode', you can simply add the flag "b" when calling fopen. But I doubt this is what you are looking for.
Cédric Moonen
Software developer
Charting control
|
|
|
|
|
do you mean that i can write :
fopen(adress,"br");
??
|
|
|
|
|
V_shr wrote: do you mean that i can write :
fopen(adress,"br");
Yes but what is adress ? It should be a char array that contains the path to the file.
But you didn't answer my question: what are you trying to do exactly ? I think binary mode is not what you think it is.
Cédric Moonen
Software developer
Charting control
|
|
|
|
|