Everything2
Near Matches
Ignore Exact
Full Text
Everything2

Not reading a string in C

created by ferrouslepidoptera

(idea) by ferrouslepidoptera (3.9 y) (print)   ?   (I like it!) Mon Jun 19 2000 at 3:19:30

This is a horrible C trick I use all the time for quick and dirty throwaway programs for reading in a string. It's definitely a bad way, and upon reaching EOF it behaves differently on different OSes, but still, it's handy sometimes.

{
	int x;
	char line[ 1000 ] ;

	/* this is horrible! but it's so easy. */
	x = fscanf(f, "%[^\n]%*c", line);
}

printable version
chaos

Reading a string in C A fine line between stupid and clever Why programmers don't comment their code C string
C Programming Tips and Tricks fscanf() How interactive fiction works (part 5) 'C' may be for cookie, but that's not good enough for me, dammit!
Boys Don't Cry quick and dirty C system()
string handling in C seven string guitar gets June 18, 2000
EOF Demanding crackhead grad student Obscene mnemonics Duff's device
Ernest Hemingway The Tick superpipelined strcmp
Y'know, if you log in, you can write something here, or contact authors directly on the site. Create a New User if you don't already have an account.
  Epicenter
Login
Password

password reminder
register

Everything2 Help

Cool Staff Picks
Things you could have written:
So you think you're Bruce Lee
fluid mosaic model
Gargouille
Watching Karen laugh
The New York Deli Experience
Dropped down, pulled out
Undertaker
Everything Professional Career Network
I Enjoy Being a Girl
Internet piracy and the working writer
Dear anonymous. Here is your moment.
Children of the Corny: A Nodermeet Out on the Prairie
Taking Down Large Larry
New Writeups
santo
The Host(review)
LostPsion
"Shut the Fuck Up" Theaters(idea)
Vanish
The line between normal and not(place)
Vanish
insanity(thing)
beatrice
You've been slowly taking me over for nearly a year, do you know that?(idea)
Berek
YouTube(thing)
shaogo
How to Pretend to Have a Job(idea)
hapax
Les Provinciales(review)
zoeb
The Scene(review)
aneurin
Telephone Numbers for drama purposes(idea)
Alnilamski
Cosmicopolis(fiction)
eien_meru
measure(idea)
Dreamvirus
pussy willow(thing)
czeano
Three "T"s(idea)
UncleM
Vantage Point 2: Fractal Thread Count(idea)
This page courtesy of The Everything Development Company