Hi everybody,
I need to use random file access for reading and writing in C language only.
For reading i have implemented the logic and its working fine.
For writing , i am not getting the idea. :(
Please help me out.
below is All brief discussion :-
File Creation :-
1. create 2 files name : "FileId.txt" and "FileData.txt" .
2. FileData.txt :
3. open "FileData.txt" file read each line one by one and calculate length of each line.
and write it 4 byte format in "FileId.txt" file.
4. FileId.txt:
0000 0014 0014 0021 0035 0024 0059 0025...
Start Pos and length of parameter.
File Reading :-
1.Open File "FileId.txt" and on basis of screen Enum value read that parameter value(enum*8) .
For Config File
File Creation :-
1. create 2 files name : "ConfigID" and "ConfigData" .
2. ConfigData:
#TERIP=111.222.333.444
#TIMEOUT=60
#PORT=1234
#TID=7678687
#MID=6687688
3. open "ConfigData" file read each line one by one and calculate length of each line.
and write 8 bytes in 4 byte format in "ConfigID" file.
4. ConfigID:
0000 0014 0014 0021 0035 0024 0059 0025...
Start Pos and length of parameter.
File Reading :-
1.Open File "ConfigData" and on basis of parameter Enum value read that parameter value(enum*8) .
File Writing :-
1. Open File "ConfigID" and basis of enum value read eight character value.
2. Open file "ConfigData" if the data , which we are going to write in the file is equal to the target data.just write the data and close the file.
if source data is less then pad the data with spaces then write to the file.
if source data is more then ? (Thats the real issue????)