While I do realize we can call the C functions from a RPG program to read the IFS files, I am trying to write a pure C/C++ code to read a file from the IFS and having a bit of a problem
Following is my code
Now my issue here is when reading the file opened using f1, I am not getting the required characters. However if I open test1.txt using wrklnk or notepad, I see the text correctly.
Edit1: One possible way I found is that my C++ program is able to read files with CCSID of 37 only. The others are giving me garbage characters as its not able to recognize it.
Any other way around this?
Following is my code
Code:
#include<fstream.h> void main() { fstream f1,f2; char input; f1.open("\dev\myfolder\test.txt",ios::in); f1>>input; cout<<input; f1.close(); f2.open("\dev\myfolder\test1.txt",ios:out); f2<<"this is test text"; f2.close(); }
Edit1: One possible way I found is that my C++ program is able to read files with CCSID of 37 only. The others are giving me garbage characters as its not able to recognize it.
Any other way around this?
Comment