Skip to content
← Back to Community
How to include Text
Profile icon
softwarenginner

I want to include my text file into my code. And if the text it match with the number or letter. I want user to access his own files.

Voters
Profile icon
emilijalorence1
Profile icon
softwarenginner
Comments
hotnewtop
Profile icon
Giothecoder
Profile icon
Giothecoder

Um. Why not just use an object? You can’t just directly place non-code in your code.

Profile icon
Zavexeon

@Giothecoder I think he's trying to turn the contents of a .txt file into a string. It's totally possible.

Profile icon
Giothecoder

@Zavexeon once it hits a certain size though, that’ll be trouble, it will take up so much space, and if you have just a single quotation mark in there and you want to make a string with a #include inside, it’s fed.

Profile icon
Giothecoder

@Giothecoder actually, getline works though. It will read to EOF if you give it a big enough buffer or a character that isn’t in the file.

Profile icon
softwarenginner

@Giothecoder I mean by that is. how Can I include my text file to my code.

Profile icon
Highwayman

@softwarenginner what you should ask yourself is: "does my txt file contain valid code?" If the answer is no, then no. If the answer is yes, then yes.