08-26-2015 01:11 PM
Robert i used function filetoarray to convert a file like this
12.23547
14.777777777
1.3325
222.368
12.3235
robert i used then arraytofile function to write these values in file.
sir is there any way when i use filetoarray function i pick ist values from above file in array.
or similearly i pick last 3 values in array?
actualy i have to pick data from different files and write in to one file at specific positions. from one file i have to write ist 4 values at diffenent position and last 4 on different.
08-26-2015 01:13 PM
i used read a line function alright and done my task with that also. but i dnt know how to bring my pointer on back after endoffile
08-26-2015 03:14 PM - edited 08-26-2015 03:20 PM
khadimhussain ha scritto:
Robert i used function filetoarray to convert a file like this
12.23547
14.777777777
1.3325
222.368
12.3235
robert i used then arraytofile function to write these values in file.
sir is there any way when i use filetoarray function i pick ist values from above file in array.
or similearly i pick last 3 values in array?
actualy i have to pick data from different files and write in to one file at specific positions. from one file i have to write ist 4 values at diffenent position and last 4 on different.
There is no way to customize FileToArray behaviour to operate as you want. Consider this function as an express way of reading a file, easy to use but rigid. If you need some more specialized task you must program it by yourself.
08-26-2015 03:19 PM - edited 08-26-2015 03:21 PM
khadimhussain ha scritto:
i used read a line function alright and done my task with that also. but i dnt know how to bring my pointer on back after endoffile
Depending on the family of functions you use there is a specific file positioning function to use: fsetpos for ANSI C library functions, SetFilePtr for Formatting and I/O Library functions (which seems to be your case).
08-27-2015 08:47 AM
If you don't care about speed to much just close the file and then reopen it. This is a quite a hack though.
Robert is correct to say use setfileptr (if used the NI function OpenFile and are working with an int file handle) or fsetpos (if you use AMSI C fopen and have ptr to FILE as a handle).
08-28-2015 11:02 AM
hi i read the help of symbol asterik * but still dsnt understand properly. kindly give me some example code of fmt in which use asterik and explain me that code. i could understand uptill now that * will be used instead of rep after % for example %*i but unable to use that comand i tried different things
for example i have
int array[8]={1,2,3,4,5,6,7,8};
Fmt (buf, "%s<%*i", array);
i could understand this but this is not working. what modifications i needed to convert array in to strings
08-28-2015 11:08 AM
When you put an asterisk in the format string, a corresponding argument must exist in the argument list.
That is, the line should read: Fmt (buf, "%s <%*i", 8, array);
08-28-2015 11:10 AM
You will need to Google "use of pointers in ANSI C code". You will need to practice and devote some trime to this concept in order to do this correctly. Nobody can give you a one sentence answer to this. It is also really beyond the scope of a discussion forum.
08-28-2015 11:18 AM
Roberto what will 8 do in that comand? i want to clear my concept means if i have array size 100 but i put only values up to 4th index than what value i will use at the place of 8.
08-28-2015 11:20 AM
sir blanky i m working hard and i will read pointers but you guys are amazing and i feel so helpful to you all of them