ok, then how about writing the entire column (including A,B,C...so on) in each loop iteration? is this possible?
example:
A
1
6
A B
1 2
6 7
Type: Posts; User: uz_mz
ok, then how about writing the entire column (including A,B,C...so on) in each loop iteration? is this possible?
example:
A
1
6
A B
1 2
6 7
Hi,
I am writing some data to a .txt file in a tabular form with headings:
A B C D E
In each loop iteration, i would like to increase the horizontal spacing (\t) in the string so that I can...
Ya, but does it hold for array of FILES also?
As in:
FILES **fHandle;
sorry..my mistake..was a typo.
Also, since I am allocating memory for 1st dimension only,
fHandle = (FILE**) calloc (4,sizeof (FILE*));
and free it by:
free(fHandle);
I do not need to loop...
sorry it should be:
fclose([fHandle[i]);
Is this right?
Then whats the correct way of calling fclose()?
@Elkvis: ya..but I need to open all files in advance, then write them during processing and close them all when I exit the program(fclose and free memory in destructor). therefore, I open pFile[0],...
@all,
I just realized that when I use an array declaration:
char cfileName[20];
it works fine.
But I also need to use an array of strings. Therefore, I did the following:
char**...
Because I want to open and write and close files dynamically.
@grumpy: They are not in the same function.
skipped code:
char cfileName[20];
for (int i=0; i<4; i++)
{
sprintf(cfileName, "Signal_%d.pcm",i);
fHandle[i] = fopen(cfileName, "ab");
fclose(fHandle);
...
I have written the following:
FILE **fHandle;fHandle = (FILE**) calloc (4,sizeof (FILE*));
/*-----open and write and close files (code skipped)-----*/
free(fHandle);
@Matticus: ya..got it! thankss..
@grumpy: thanks for ur advice. But Iam unable to add path along with the file name (as shown in my example above).
How can I do it?
I have following lines to write signals in binary mode:
short sOut[256];
if(1)
{
fHandle = 0;
/* write the file in binary mode */
for (i=0; i<3; i++) //loop along channels
{
for (k=0;...
Hello,
I would like to choose same case for multiple switch conditions.
For example:
switch(choice) //''if choice ==0 or choice ==1, chose same case''
{
case (0 || 1):
{
installing this update fixed the problem! :-)
Download Details | Microsoft Connect
Hi,
This is not related to C-programming, but I think you guys being experts can help me on this. I use MS visual studio 2010. Since past two days, I realized that the 'Intellisense' feature of...
thanks a lot guys for your inputs..!!
Hi,
I have the following situation:
void myFun(float *pfMyPtr)
{
float Val[] = {0.234, 0,432, 0.322, 0762, 0.984};
pfMyPtr = Val;
}
It compiles fine and works as desired too.
But When I set a break point, then I see the following:
name value type
bAct 0x01774ca8...
Can I do the following? Is it a good practice?
bool *bAct;
bAct = (bool*) calloc (2, sizeof(bool));
for (i=0;i<2;++i)
{
bAct[i] = true; //initialize
}
I assumed so because when I print out the result after 'either ways' of assignment, B prints the same array as A.
And also:
&B[0] == &A[0];
&B[1] == &A[1];
I mean when we are printing result after
B=A and
for (i==;i>2;++i)
{
B[i]=A[i];
}
We see that B has row elements equal to that of A (as desired) in both the cases.
You said that for...
You said for every valid i, B[i] ==A[i], meaning,
B[0]=A[0];
B[0]=A[1];
isit right? then when we print out A and B after this step, the result is as desired with B[i]=A[i] as in:
...
I understand the points you made.
Following code demonstrates my question (please ignore freeing memory at the moment):
#include <stdio.h>
#include <stdlib.h>
int main()
{
...
thanks all for ur valuable inputs. It was very helpful!
I still have a small query. As I said in my previous post, When I set initially B=A; then there is a memory leak when I switch between the...