I have a c++ program that creates a .txt file and writes output to it. When I open with it with different clients, in this case Clion, Atom, and Gedit, the displays are differently. I tried googling a solution or an explanation, but no luck so far.
This is in Atom
This is in Clion
This is Gedit
What is actually the problem? The way I am writing the output? The client? The encoding?
Extra: What would be the best format to output the displayed data? .txt, .log, others?
Thanks!
Related
So I would like to make a program like this: we choose .txt file to open and it makes a plot based on it. The format of data is:
12:52:11 30.2
12:53:52 31.2
etc.
I think about doing it in C++, but first I want to check whether there's an easier option than Gnuplot (because I'm using Windows XP and can't use Linux terminal commands). I've seen DatPlot, but it's too inconvient for multiple files use. What do you recommend? I would be very grateful for any help. Cheers. :)
I've been at it all night just trying to get a simple program to read in a text file and then copy it/write it back into a binary format.
My code looped through the text doc, got the data, put it in the buffer and wrote it back out. Heck I even hard coded the data I wanted to be written out in binary.
I used fstream, ofstream, example: fp1.open("student.dat",ios::binary);
and was reading up on several different sites such as:
http://www.functionx.com/cpp/articles/serialization.htm
http://www.cppforschool.com/tutorial/files2.html
and I had working code, but when I open the .bin file in my Notepad++ I saw that my text data still looked like text and wasn't really 'converted' over to any hexdecimal format, or anything really. Numbers were, and I double checked to see if they were accurate by y'know, a little website where you can type in the number and it spits out the hex.
I was so fed up as to why my text wasn't converting that I destroyed all my code and tried to start over. *hence the lack of examples"
So, my question, finally is, why wasn't the text changing in any way, is this normal for a binary file and using this method? I've even used pre-made coding examples and it all came out the same way. Am I just expecting it to all look like 1's and 0's and really it's not and it was all really working?
My main project is to convert an .OBJ file to binary data, but really how should I be looking at this? How should this binary file look?
Any advice would be greatly appreciated!!!
Thank you!
I was just using Chars and string and wasn't seeing a difference. Once I started using other data types, it became apparent that there was a change. I understand that .OBJ and .txt are binary file types, i just expected a bigger change. I used cplusplus.com and reviewed what I needed to know more of. Thank you for trying to help I guess!
I am new to c++ and even newer to Qt on Linux.
Can any one give me a general idea of how to display text in a textbrowser in Qt? I can't post my code because of the seative nature of the project I am working on. All I need is a basic understanding of how to do this related to slots and signals.
My application is this: I am taking input from a CSV file, counting the ords and then displaying the number of counted words along with the line of text in an output window.
It works fine in console c++ program. However, when I code it in Qt, it does not work.
Any advise or help would be welcome.
sorry for the bad question I asked earlier.
It turns out it was a configuration issue on my part.
i am doing a project that has some simple values(login,password,name,age). I was searching on the internet how to create an excel file on Visual C++, and i cant undestand it . I just want the simple way, i just want to see on my excel files 2 colums one having some login codes of my program and on the other the passwords. My programing level its not really high and im not an english speaker, so id like you guys to explain a bit or give me something simple.
Thanks for your time
If all you want is a simple file with 2 columns of data, I'd make a CSV (Comma Seperated Values) file, which can be opened in Excel, or any text editor. The CSV will look "nice" in Excel, as if it were an actual XLS file. Also, you won't be tied to Microsoft Office. This file can be written with simple string manipulations and file I/O.
The format would be :
Column1,Column2
data1,data2
data3,data4
However, and this is a big one... storing usernames and passwords in plain text is never a good idea.
Maybe there is some code from this web site that can help you out. It seems well documented and it was made for people to learn from it.
http://www.codeproject.com/Articles/15837/Accessing-Excel-Spreadsheets-via-C
Hope that helps!
I want to convert all the .odt .doc .xls .pdf files to .txt files.
I want to convert these files to text files using a shell script or a perl script
There's a program for odt files and alikes:
odt2txt - avaliable in repos.
$ unoconv --format=txt document1.odt
Should produce document1.txt.
OpenOffice has a built-in document converter capable of handling a bunch of formats- take a look at unoconv: http://dag.wieers.com/home-made/unoconv/
That being said, I have had some troubles getting that to work in the past- If you're having trouble, take a look at similar programs for AbiWord (another open source word processor).
For word documents, you can try antiword, at least on linux. It's a command line utility that takes a word document as an argument, and spits out the text from that document (as best as it can figure) to Standard Output. Maybe you can specify an ouput file too. I can't remember the details of how it works. I haven't used it in a while. Not sure if it can handle OO documents.
It's certainly possible to do this, though there is something strange and impenetrable about the OO project and its documentation that makes things like this hard to research and follow. However, OO has the capability to convert all of those types, not just the OO native ones, and it can do it via two different forms of automatic control.
These are the two general approaches.
You can start OO and tell it to execute a macro which does this job for you for a given file. You then just have to write the macro and a script to loop over your files. The syntax is something like
$ oowriter -headless filename macro://dir/Standard.Module1.sMySub
The other thing OO has is a network API. This is based on something called UNO.
$ oowriter -accept=accept-string
Notifies the OpenOffice.org software that upon the creation of
"UNO Acceptor Threads", a "UNO Accept String" will be used.
You will need some sort of client library. I think they have one for Python at least. Using this technology a Python program or some other scripting language with an OO client library could drive the program and convert all the files. Since OO reads MSO, it should be able to do all of them.
Open the file in LibreOffice. Click on "File", "Save-as" scroll down to find the text option. Click that and it will be saved as a text file.
FYI, I had an *.ODT file that was 339.2 KB in size. When I save-as text the size of the file shrunk to ONLY 5.0 KB. Another reason for saving your files as text files.
For the Microsoft formats, look into the wvWare tools.
Open .ods file normally in libre office
Highlight text to be converted
Open a terminal
Run vi
Press "i" to get insert mode
Press ctrl-shift-v
Done!
Need some formatting?
Save the file as
Get out of vi
Run:
$cat | column >filename2
This worked in opensuse running KDE
Substitute "kwrite" for "vi", if you want