All Questions
14 questions
3
votes
1
answer
172
views
How to refactor this (sort of) getline implementation?
Goals:
Create a function char *get_next_line(int fd) such as:
Repeated calls (e.g., using a loop) to your get_next_line() ...
4
votes
3
answers
803
views
Implementing strscpy(): Is using errno as a negative return value a bad practice?
strscpy() is similar to the standard strncpy() except that it always writes a valid null-terminated string (unless ...
11
votes
3
answers
2k
views
Remove leading zeroes from the beginning of a string
I want to remove leading zeroes (for a big integer library I'm currently making) in numbers represented as char arrays.
I chose assembly for speed, but in order to simplify making the algorithm and ...
1
vote
1
answer
195
views
Getting 6000+ substrings from large a large string
I have a class that opens a text file and reads out its content.
This class has a member function that will extract a substring between two given delimiters.
My application needs to extract between ...
4
votes
3
answers
6k
views
Simple puts() function in x64 assembly
I'm trying to write as simple I/O library in x64 using linux syscalls
...
3
votes
2
answers
93
views
Password string generation
I'm trying to create passwords using the following snippet to match a custom password policy. I've added three gtr statements, at the end of the string, to ...
3
votes
1
answer
544
views
Mapping Index to a String in C
Please excuse my potentially noob-ish question. I haven't touched strings in C (or C in general) in a while, and I seem to recall there being different ways you can return a C string from a function (...
0
votes
1
answer
835
views
Find common directory path
I answered the problem of Find common directory path from Rosetta Code.
The problem consists of passing '/home/user1/tmp/coverage/test',
...
8
votes
3
answers
5k
views
Removing multiple slashes from path
I have been trying to write a sample code block to remove multiple backward or forward slashes from a path (e.g. //a//b should be ...
4
votes
2
answers
84
views
Parse a substring out of string, allocate memory accordingly
I have written the following code in order to:
Find begin and end of FTP user and password from a given URL (ftp://[user[:password]@]host[:port]/url-path)
Allocate ...
4
votes
1
answer
686
views
Parsing a string to extract values
I am writing some C# that will be running on Linux and will extract values from a kernel generated system file that represents readings from a sensor.
The file contains two lines of text, and I have ...
3
votes
2
answers
250
views
Optimizing string replacement program that uses recursion
I have the following string replacement program for a string of size 256:
I am replacing the string
"\'"
with the string
'
Please suggest any modifications if needed or any mistake I ...
3
votes
1
answer
6k
views
Converting from std::wstring to std::string in Linux
I was bothered by inability of C++ to mix cout and wcout in the same program - so I've found this question:
Converting between ...
9
votes
3
answers
8k
views
x86 strcpy implementation
I got about 4 days of assembly knowledge, so I need a review on this strcpy function and if it can be done better (at least I have the feeling).
Full code (with ...