© 2014 Firstsoft Technologies (P) Limited. login
Hi 'Guest'
Home SiteMap Contact Us Disclaimer
enggedu


  Home Placement Paper Kit Technical Questions ► C and C++ ▼

361.How can I print numbers with commas separating the thousands?
What about currency formatted numbers?

362.fopen is failing for certain pathnames.

363.How can I write code to conform to these old, binary data file formats?

364.Why doesn't the call scanf("%d", i) work?

365.How can I insert or delete a line (or record) in the middle of a file?

366.. How can I convert numbers to strings (the opposite of atoi)? Is there an itoa function?

367.Why doesn't this code: double d; scanf("%f", &d);work?

368.Does C have anything like the ``substr'' (extract substring) routine present in other languages?

369.How can I recover the file name given an open stream?

370.Why doesn't the code short int s; scanf("%d", &s);work?

371.How can I redirect stdin or stdout to a file from within a program?

372.. How can I specify a variable width in a scanf format string?

373.Once I've used freopen, how can I get the original stdout (or stdin) back?

374.Why does strncpy not always place a '\0' terminator in the destination string?

375.How can I read data from data files with particular formats?
How can I read ten floats without having to use a jawbreaker scanf format
like "%f %f %f %f %f %f %f %f %f %f"?
How can I read an arbitrary number of fields from a line into an array?

376.How can I sort a linked list?

377.How can I tell if standard input or output is redirected (i.e. whether ``<'' or ``>'' was used on the invocation command line)?

378.Does C have anything like the ``substr'' (extract substring) routine present in other languages?

379.When I read numbers from the keyboard with scanf and a "%d\n" format, like this:

int n; scanf("%d\n", &n); printf("you typed %d\n", n);

it seems to hang until I type one extra line of input.

380.How can I sort more data than will fit in memory?

381.How can I arrange to have output go two places at once, e.g. to the screen and to a file?

382.Why does everyone say not to use scanf? What should I use instead?

383.How can I get the current date or time of day in a C program?

384.How can I tell how much destination buffer space I'll need for an arbitrary sprintf call? How can I avoid overflowing the destination buffer with sprintf?

385.I know that the library function localtime will convert a time_t into a broken-down struct tm, and that ctime will convert a time_t to a printable string. How can I perform the inverse operations of converting a struct tm or a string into a time_t?

386.I want to read and write numbers between files and memory in a byte-at-a-time way, not as formatted characters the way fprintf and fscanf do. How can I do this?

388.What's the deal on sprintf's return value? Is it an int or a char *?

389.How can I add N days to a date? How can I find the difference between two dates?

390.I'm writing a ``filter'' for binary files, but stdin and stdout are preopened as text streams. How can I change their mode to binary?

391.What's the difference between fgetpos/fsetpos and ftell/fseek?
What are fgetpos and fsetpos good for?

392.Did C have any Year 2000 problems?

393.What's the difference between text and binary I/O?

394.How can I flush pending input so that a user's typeahead isn't read at the next prompt? Will fflush(stdin) work?

395. How can I return a sequence of random numbers which don't repeat at all?

396.How can I read/write structures from/to data files?

397.How can I generate floating-point random numbers?

398.What does it mean when the linker says that _end is undefined?

399.How can I open files with names like ``file1'', ``file2'', ``file3'', etc., where the numeric part is controlled by a variable? Basically I want ``file%d'', like printf

400.Is exit(status) truly equivalent to returning the same status from main?

Page 10

1 2 3 4 5 6 7 8 9 10 11 12 13
SLogix Student Projects

⇓Student Projects⇓
⇑Student Projects⇑
bottom